Skip to Main Content

SQL & PL/SQL

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 to Insert data into sybase table with data output from Oracle function

ArieanJan 21 2011 — edited Feb 2 2011
i am using oracle reference cursor variable in a function and using the below statement to execute and getting the output which is shown below as well.
SQL> SELECT DEC_RTN_RECORDSET2(SYSDATE) FROM DUAL;

DEC_RTN_RECORDSET2(S
--------------------
CURSOR STATEMENT : 1

CURSOR STATEMENT : 1

INVOICE_NUMBER INVOICE_D  CLIENT_ID INVOICE_AMT
-------------- --------- ---------- -----------
             1 21-JAN-11        101        1100
             2 21-JAN-11        102        1100
             3 21-JAN-11        103        1100
             4 21-JAN-11        104        1100
Now my requirement is to use or call this function on a sybase DB through an RPC and insert the returned data returned by this function into a table on sybase database. Is it possible to do so?? can you please help me here. I was doing similar exercise on Oracle DB with predefined table having similar columns & datatypes returned by function above but unsuccessful as shown below. Appreciate your help with workable solution on Sybase/Oracle though preference is former, Thank you.
SQL> DESC INVOICE2;
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 INVOICE_NUMBER                            NOT NULL NUMBER(9)
 INVOICE_DATE                              NOT NULL DATE
 CLIENT_ID                                 NOT NULL NUMBER(9)
 INVOICE_AMT                               NOT NULL NUMBER(9,2)

SQL> 
SQL> INSERT INTO INVOICE2
  2  SELECT DEC_RTN_RECORDSET2(SYSDATE) FROM DUAL;
INSERT INTO INVOICE2
            *
ERROR at line 1:
ORA-00947: not enough values
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 2 2011
Added on Jan 21 2011
6 comments
758 views