972287 wrote:What exactly is the problem? If the code below does what you want for 20 columns (such as F0001, F0002, ....), it should work for any number of columns.
I have a problema with PLSQL, i need transpose more than 40 elements. I use this comand for only first 20 elements, but for more oracle have problems.
Another idea for this ¿?If you're using Oracle 11, you could also user the SELECT ... PIVOT feature.
declareThe only "table" in this query is the in-line view that returns 3 columns: ide (not ide<b>trans</b>), cpo and valr.
FOR someone IN ( select idetrans,
max( decode( cpo, 'F0001', valr, null ) ) F0001 ,If you're not doing anyhting with the pivoted columns, why bother computing them? Everything above could just be replaced by:
max( decode( cpo, 'F0002', valr, null ) ) F0002 ,
max( decode( cpo, 'F0003', valr, null ) ) F0003 ,
max( decode( cpo, 'F0023', valr, null ) ) F0023 ,
max( decode( cpo, 'F0024', valr, null ) ) F0024 ,
max( decode( cpo, 'F0025', valr, null ) ) F0025
from ( select ide, cpo, valr
group by ide, cpo, valr )
group by ide)
v_ide := someone.ide;
DBMS_OUTPUT.PUT_LINE('Name = ' || someone.ide);
SELECT DISTINCT 'Name = ' || ide FROM int_datos_objfis ;
Help me please to firstname.lastname@example.orgWhenever you have a problem, please post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) from all tables involved.
972287 wrote:Of course you shouldn't post anything private. Change whatever data, column names and table names you have to, and post CREATE TABLE and INSERT statements for the modified tables, as well as your query (or PL/SQL code) that references those modified tables and data. Post the results you want to get from the modified data, and explain how you get those results from the data you posted.
... I didnt copy my original code only change some field for security :)
... My Oracle Version with select * from v$version is:That's very old; Oracle 10 was released in 2003. Think about upgrading. The SELECT ... PIVOT feature is just one reason why that will help you.
Oracle9i Release 188.8.131.52.0 - 64bit Production ...
... NOTE: some comand are restricte like 'with' o 'rownum' .Sorry, I don't understand.