Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

cog (4665)

Journal of cog (4665)

Thursday October 28, 2004
10:28 AM

select count(*) from all tables

[ #21569 ]
in Oracle,

select (select count(*) from table_a) A, (select count(*) from table_b) B, ... from dual;

I'm pretty sure there are other ways, of course (looks like a friend of mine just came up with one that actually doesn't need the dual table; hence, it's portable).

I thought I'd store and share that information :-)

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • looks like a friend of mine just came up with one that actually doesn't need the dual table
    Was it this?:
    select count(*) A,
    (select count(*)
    from table2) B
    from table1
    • I'm not sure, because he seems to be in the zone (where I should be too, probably), and I seem unable to ask him :-)

      Hum... but I can't seem to put that code to work... :-|

      • Hum... but I can't seem to put that code to work
        Hmmm, works in Informix and SqlServer...is there an error in Oracle?
        • Yes, there's an error when running that in Oracle.

          SQL> select count(*) A, (select count(*) from config) B from config;
          select count(*) A, (select count(*) from config) B from config
          *
          ERROR at line 1:
          ORA-00937: not a single-group group function


          SQL>

          That was also not the solution from my friend... I already asked him again... he's trying to remember :-)