Question about dynamic SQL
From: Wolfgang Roehl <Wolfgang.Roehl_at_dlr.de>
Date: 1997/11/06
Message-ID: <34619C46.44851415_at_dlr.de>#1/1
END LOOP;
CLOSE C1;
End;
Date: 1997/11/06
Message-ID: <34619C46.44851415_at_dlr.de>#1/1
Hi!
[Quoted] In Forms 4.5 I want to create a dynamic SQL statement where the olumn name was primary selected from the sys.dba_tab_columns table. The whole thing should run in a cursor loop. I don't know how to put the resulting column name into the statement.
Example:
Declare
CURSOR C1 IS
SELECT COLUMN_NAME
FROM SYS.DBA_TAB_COLUMNS
WHERE TABLE_NAME = 'TAB'
ORDER BY COLUMN_ID;
Begin
OPEN C1;
LOOP
FETCH C1 INTO :PARAMETER.COLUMN;
EXIT WHEN C1%NOTFOUND;
SELECT 'X' FROM TAB_USER WHERE Seq_Nr_User = 1 AND :PARAMETER.COLUMN = (SELECT :PARAMETER.COLUMN FROM TAB WHERE Seq_Nr = 1); IF SQL%NOTFOUND THEN <do something> END IF;
END LOOP;
CLOSE C1;
End;
I would appreciate any comment or hint.
Thx in advance
Wolfgang
-- ////////////////////////////////////////////////////////////////////////Received on Thu Nov 06 1997 - 00:00:00 CET
/ DLR, Central Data Processing Division, CASE Service /
/ __/|__ Wolgang Roehl, Softwareentwicklung und -wartung / / /_/_/_/ Lilienthalplatz 7 / / |/ D-38108 Braunschweig /
/ Telephone: ++49 (0)531-295-2789, Fax ++49 (0)531-295-2880 /
////////////////////////////////////////////////////////////////////////