|
Re: multiple queries and 1 output window/result [message #684294 is a reply to message #684293] |
Mon, 03 May 2021 10:24   |
 |
Michel Cadot
Messages: 68417 Registered: March 2007 Location: Nanterre, France, http://...
|
Senior Member Account Moderator |
|
|
Welcome to the forum.
Please read the OraFAQ Forum Guide and How to use [code] tags and make your code easier to read.
Indent the code, use code tags and align the columns in result.
There are many solutions, here's (complex) one:
SQL> select column_value table_name,
2 xmlcast(
3 xmlquery(
4 ('count(ora:view("SCOTT","' || column_value || '"))')
5 returning content)
6 as int) rows_in_table
7 from table(sys.odcivarchar2list('EMP','DEPT','BONUS','SALGRADE'))
8 /
TABLE_NAME ROWS_IN_TABLE
--------------- -------------
EMP 15
DEPT 4
BONUS 0
SALGRADE 5
[Updated on: Mon, 03 May 2021 10:27] Report message to a moderator
|
|
|
|
|
Re: multiple queries and 1 output window/result [message #684297 is a reply to message #684294] |
Mon, 03 May 2021 11:16   |
Solomon Yakobson
Messages: 3212 Registered: January 2010 Location: Connecticut, USA
|
Senior Member |
|
|
Michel,
Oracle XQuery function ora:view is desupported. Use XQuery functions fn:collection instead:
select column_value table_name,
xmlcast(
xmlquery(
('count(fn:collection("oradb:/SCOTT/' || column_value || '"))')
returning content
)
as int
) rows_in_table
from table(sys.odcivarchar2list('EMP','DEPT','BONUS','SALGRADE'))
/
TABLE_NAME ROWS_IN_TABLE
------------------------------ -------------
EMP 14
DEPT 4
BONUS 0
SALGRADE 5
SQL>
SY.
|
|
|
|
Re: multiple queries and 1 output window/result [message #684299 is a reply to message #684296] |
Mon, 03 May 2021 12:08  |
 |
Michel Cadot
Messages: 68417 Registered: March 2007 Location: Nanterre, France, http://...
|
Senior Member Account Moderator |
|
|
abenitez77 wrote on Mon, 03 May 2021 17:29Thank you both. Michael, could you explain what "SCOTT" value is for in this query you provided?
('count(ora:view("SCOTT","' || table_name || '"))')
Thanks!
Alex
SCOTT is the owner of the tables here.
Use Solomon's query instead.
Or John's one if the table list is fixed.
[Updated on: Mon, 03 May 2021 12:09] Report message to a moderator
|
|
|