Home > database >  Consult the Oracle according to the column of the query data?
Consult the Oracle according to the column of the query data?

Time:10-08

A table of field fieldName preserved b table column name

Problem: the first from a table column names, and how to use these names found b table data, thank you!

Select (select fieldName from a) from b??




CodePudding user response:

Need to use dynamic statement
The execute immediate 'select' | | select wmsys. Wm_concat (fieldname) from a | | 'from b';

CodePudding user response:

reference 1st floor js14982 response:
need to use dynamic statement
The execute immediate 'select' | | select wmsys. Wm_concat (fieldname) from a | | 'from b';

Oracle dynamic statements are not allowed to select queries multi-line returning directly, can only create a temporary table query again
The execute immediate 'create table test as the select' | | select wmsys. Wm_concat (fieldname) from a | | 'from b';
Select * from the test;

CodePudding user response:

Write a stored procedure returns a dynamic cursor, iterative processing in the program
  • Related