I have a scenario, where 100's of select statements sql's are in one metadata table or some text file.
Need to insert all sql results into one specific table. (master table has col1, col2,col3 .... 200columns )
problem im facing(ORA-00947) is every select statement has different number of columns. .. i need to generate INSERT PART.
CASE 1 : INSERT INTO (COL1,COL2,COL3) <<this select part comes from file/variable>>
CASE 2 : INSERT INTO (COL1) <<this select part comes from file/variable>>
CASE 3 : INSERT INTO (COL1) <<this select part comes from file/variable>>
have to figure out how many columns are in select part then generate INSERT part. .
Thought of create as select but problem is some select statement has max(col) without alias so it will fail.
<<this select part comes from file/variable>>
unless it comes with the correct metadata for each select so we can assemble the dynamic SQL correctly. – APCmaster table
should receivemax(col)
if there is no matched column alias? Does themaster table
have some reliable way to translate, for examplemax(col)
=> MAX_COL or something? – alexgibbs