Skip to Main Content

SQL Developer

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How do I get the rows (and columns) from a stored procedure to display normally?

ToolTimeTaborMar 2 2022 — edited Mar 2 2022

I am not finding any examples on how to get a traditional grid (rows and columns) returned from a store procedure.
My source is an Oracle Stored Procedure and I need to transfer the output of that procedure into a table.
Suppose I have a procedure:

CREATE OR REPLACE PROCEDURE spAddress(addresses IN OUT SYS_REFCURSOR) 
AS
BEGIN
  OPEN addresses FOR SELECT ID, SALUTATION, ZIP FROM ADDRESS;
END;

In MS SQL server, I would simply EXECUTE it, as in the following:

EXECUTE spAddress();

and I would get a data grid displayed with the list of addresses where there were rows and columns displayed the same as if I had run

SELECT ID, SALUTATION, ZIP FROM ADDRESS;

The result would look something like this in the my developer:
image.pngEvery example that I have seen uses DBMS_OUTPUT to create a concatenated line of text that includes ID, SALUTATION and ZIP, but its one single column of strings. What I want is the rows and distinct columns with column data types, as if I had run the SELECT directly.
I know they are there, because I can see the results from running it...
image.pngimage.pngThe output variables clearly show the rows and columns, as they appear in the query without needing to use DBMS_OUTPUT and concatenations.
How do I get a proper data grid from executing a procedure? Something that looks like this:
image.pngMy ultimate objective is to use the output of a procedure as the input to an INSERT command. For example, let's say I am trying to populate a table called ADDRESS_LOCATIONS from my example. What I want to be able to do is along the lines of:

INSERT INTO ADDRESS_LOCATIONS (ID, SALUTATION, ZIP)
SELECT ID, SALUTATION, ZIP FROM spAddress;

Note: the actual source procedure is more complicated, so I cannot use a simple SELECT against the table directly, as shown here:

INSERT INTO ADDRESS_LOCATIONS (ID, SALUTATION, ZIP)
SELECT ID, SALUTATION, ZIP FROM ADDRESS;

Comments

Hello

The Subtree Delete Control (1.2.840.113556.1.4.805) supported by OUD (Supported LDAP Controls - Oracle Fusion Middleware Architecture Reference for Oracle Unified Directory)  might fit your needs.

This control is attached to a delete request to indicate that the specified entry and all descendant entries are to be deleted.

You must have appropriate privileges to do that (admin account)

You can attached control to a ldapdelete using the -J option as described in ldapdelete - Oracle Fusion Middleware Command-Line Usage Guide for Oracle Unified Directory

Sylvain

------

When closing a thread as answered remember to mark the correct and helpful posts to make it easier for others to find them

900846

Thanks Sylvain.

I tried with this command to delete entries

ldapdelete -J subtreedelete -h localhost -p 1389 -D "cn=Directory Manager" -w password -x ou=ext,ou=users,dc=example,dc=com

There are about 2 lakhs entries inside this OU and it is taking infact it is running since a hr and still it has not completed the operation.

Is there some other setting which i need to do.

regards,

Ram

Hello,

There is no additional thing to do, adding the control should work.

If it takes a very long time to delete thats one thing, if  it never completes and seem to hang this is another thing.

Has it deleted some entries or does it seem to hang w/o deleting any entry ?

Current implementation may be slow with large trees.

If the problem persists, I would encourage you to contact the Oracle Support so that they can investigate

Sylvain

------

When closing a thread as answered remember to mark the correct and helpful posts to make it easier for others to find them

900846

Thanks Sylvain, i have raised an SR and awaiting for the response

1 - 4

Post Details

Added on Mar 2 2022
7 comments
6,883 views