Solved

Convert PL/SQL to SQL

Posted on 2008-10-07
2
753 Views
Last Modified: 2013-12-07
Hello,

I need to convert a PL/SQL block to standard ANSI SQL (attached).  What can you recommend?


Thanks,

Michael

DECLARE
   CURSOR c IS SELECT count(1) amount, pnd_index_owner OWNER FROM ctxsys.ctx_pending GROUP BY pnd_index_owner;
   pending_rec c%ROWTYPE;
BEGIN
   OPEN c;
   LOOP
      FETCH c INTO pending_rec;
         EXIT WHEN c%NOTFOUND;
         DBMS_OUTPUT.PUT_LINE(rpad(pending_rec.owner, 15,'.') || pending_rec.AMOUNT);
   END LOOP;
END;

Open in new window

ots.txt
0
Comment
Question by:michael4606
2 Comments
 
LVL 14

Accepted Solution

by:
GGuzdziol earned 125 total points
ID: 22659180

SELECT rpad(pnd_index_owner, 15, '.') || to_char(count(*))
  FROM ctxsys.ctx_pending
  GROUP BY pnd_index_owner

Open in new window

0
 

Author Closing Comment

by:michael4606
ID: 31503847
GGuzdziol,

That is perfect!
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
This video shows how to recover a database from a user managed backup
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question