wizlog
wizlog

Reputation: 302

Print output of count to DBMS

I'm trying to run the same query over and over again so I can get the status of a process.

How do I use PL/SQL and the DBMS window or just the Query Result window to accomplish this?

My query looks like this:

Select count(table1.*) from table1
inner join table2 on table1.fk = table2.fk
inner join table3 on table3.fk = table2.fk
where 
table1.col2={a value}

I've looked at several answers which discussed using a loop or dbms.output.put_line() but can't get my court to be what's displayed.

Sample data of info in these tables:

table1.columnName has company IDs and a program/process IDs

Col1 | Col2 | col3
1    | 42   | 2
2    | 42   | 2
3    | 42   | 2
1    | 41   | 2
4    | 41   | 2
1    | 43   | 2

Example output for the query where table1.col2=42 would be 3 because there are 3 rows where Col2 has value 42

Thank you

Upvotes: 0

Views: 219

Answers (1)

Athul Sreehari
Athul Sreehari

Reputation: 33

in the result window just type / and hit enter and you get the new count without typing in the entire query again. in the pl_sql you can use a unix script and a sendmail command to get the results delivered to your inbox.

Upvotes: 1

Related Questions