?
Solved

Convert PL/SQL to SQL

Posted on 2008-10-07
2
Medium Priority
?
756 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 14

Accepted Solution

by:
GGuzdziol earned 500 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Suggested Courses

801 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