DB Links vs Synonym

Hi I have a quick question; I have to join schema_1.table_1 to schema_2.table_2 but they are in different databases db_1 and db_2. I noticed that there is a dblink from schema_1.table_1 to schema_2.table_2.db_2.
But would that affect my performance if i join using dblink?
Would creating a Public synonym for the schema_2.table_2 help me in performance....Any other workarounds????
Maybe an Index on that joining column might help me in performance? Should i create the Index in database_1 or Database_2????
Thanks,
Kon

Yes, it is likely that joining two tables across a database link is going to have an impact on performance (at least compared to joining the same two tables on a local database). Realistically, in order to join two tables, you have to send lots of data from one database to another over the network, which is generally rather slow. If the optimizer picks the wrong database to be the driving site, that can be a major problem.
Creating a public synonym would not affect performance if the target object is still on the remote database. A synonym is often a good idea from a maintainability standpoint if, for example, the database link name were to change (particularly in lower environments), if you want to leave yourself open to moving the table (or a copy of the table) to a different database, etc.
An index may or may not be beneficial. If you create an index, it has to be on the same database that the underlying table is in.
If this is something that is going to happen regularly, can you replicate the table from the remote database to the local database?
Justin

Similar Messages

  • DB Link Public Synonym

    Hi Guys
    I have a public SYNONYM that was created to access a table on the remote database using a DB Link.
    We are able to access the DB Link using SQL Plus and the Synonym BUT when the same is used inside the cursor query of a PL/SQL block we get the following error message!
    This is driving me crazy... need your expert suggestion :)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Errors for PROCEDURE SP_PROCESS_SESEBA031:
    59/12 PLS-00341: declaration of cursor 'V_CUR' is incomplete or
    malformed
    60/9 PL/SQL: ORA-01775: looping chain of synonyms
    60/9 PL/SQL: SQL Statement ignored
    95/15 PL/SQL: Item ignored
    123/9 PL/SQL: SQL Statement ignored
    124/18 PLS-00320: the declaration of the type of this expression is
    incomplete or malformed
    127/9 PL/SQL: Statement ignored
    127/12 PLS-00320: the declaration of the type of this expression is
    incomplete or malformed
    148/13 PL/SQL: SQL Statement ignored
    161/37 PL/SQL: ORA-00904: "V_DTL_REC"."TRADE_DATE": invalid identifier
    161/37 PLS-00320: the declaration of the type of this expression is
    incomplete or malformed
    180/9 PL/SQL: Statement ignored
    180/53 PLS-00320: the declaration of the type of this expression is
    incomplete or malformed
    182/9 PL/SQL: SQL Statement ignored
    213/14 PLS-00320: the declaration of the type of this expression is
    incomplete or malformed
    213/24 PL/SQL: ORA-00984: column not allowed here
    Compile source: /usctreg1/app/db/proc/SP_PROCESS_SESECRC.src
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Thanks & Best Regards,
    Faisal.

    Hi,
    As I say, when we access the synonym (that links to a table through a DBLINK) we have this issue. The code can be as simple as
    DECLARE
    var1 int := 0;
    CURSOR S1 IS SELECT col1, col2 from TB_DBLINK;
    BEGIN
    LOOP through Cursor S1
    END;
    Here the TB_DBLINK is:
    CREATE PUBLIC SYNONYM TB_DBLINK FOR TB_DBLINK@DBL1
    The TB_DBLINK on the DBL1 is also a Public Synonym... So it means that a Public Synonym is being created for a Public Synonym!
    Able to access this using SQL Plus simple select though :(

  • Export Database Link & Public Synonyms using Expdp

    Dear All,
    We are using expdp to do schema level exports:
    expdp dumpfile=<Directory>:expdp.dmp SCHEMAS=S1,S2,S3
    We also want to export the Public/Private Synonyms (created for the objects owned by above users), Public/Private Database Links as part of above command.
    How we can achieve this? We are using 11gR2.
    regards,
    Riaz

    HI,
    Public synonym can not be exported and never exported even at FULL Export also. . You can get them from "dba_synonyms". I suggest that you create so customer script .
    select      'create public synonym ' || table_name || ' for ' || table_owner || '.' || table_name || ';'
    from      dba_synonyms
    where
         owner='PUBLIC' and table_owner not in ('SYS', 'SYSTEM')
    order by
         table_owner;
    More: Information:
    https://forums.oracle.com/thread/855639?start=0&tstart=0
    Oracle Data Pump Schema Export and Public Synonyms
    Thank you

  • DB Links and Synonyms - Help please

    Hi,
    I have two databases, say 'db1' and 'db2'
    In 'db1' database,
    I have created one user, 'usr1' and who has access to all tables in a schema 'sch'
    In 'db2' database, (following all actions are in 'db2' database)
    I have created public database link, 'dblink.world' connect to usr1 identified by password using db1.
    I have also created one public synonym, db1_tab1 for [email protected];
    when I query like, select * from db1_tab, I am getting output.
    But in Toad, if I select 'db1_tab1' in 'Synonyms' tab, I am getting following error. I don't have any LONG columns in the table.
    ORA-00997: illegal use of LONG datatype
    I am working on Oracle release 9.2.
    Please help me to resolve this error.
    Thanks.

    If TOAD isn't working you may have to get another tool or patch the version of TOAD :(
    Oracle SQL Developer offers much the same funcitonality and is free; you can download it from OTN.

  • Link for synonym in Oracle to MS Access

    hi,
    i want to access a table which is created and placed in MS Access
    database and i want to access it in Oracle using synonym,,how is it
    possible?
    Regards

    Search Oracle documents for Heterogeneous Services

  • Performance of DB Link VS Public Synonyms

    1) In a single database(Oracle 9.2) , I have multiple schema say a, b ,c d ,e etc.Currently we are using public synonyms to access tables of other schema.There is a plan to split the database into two or three DB and to use db links instead of public synonyms.So what would be impact on performance?
    2) In a same database for accessing multiple schema objects which one between DB link and Synonym is a better approach and why? How are the working mechanism for each of them?
    Appreciate your quick response.

    MSINHA wrote:
    No, on the same server we will have different instances. We are trying to split the schema into separate DB so as to independently upgrade them as they are for different applications and modules but some of the tables are common and being accessed using public synonym.Horrible idea to run multiple database instances on a single server. This is not how servers scale.
    Oracle scales by adding more servers to a single database - this is called RAC.
    Your approach is the exact opposite. Adding more databases to a single server.
    That approach seldom makes any technical sense - and is usually forced by circumstances (like running 2 different Oracle versions) and not by sound technical, performance and scalability reasons.
    Keep in mind that an Oracle database is NOT architecturally and technically the same as a mySQL or SQL-Server database. A mySQL/SQL-Server database is called a schema in the Oracle environment.

  • Backing up synonyms and db links

    Hi All,
    I am in process of refreshing the one of our test database from other development box. here , I am thinking of creating a table , which would contain the names of name , status of db links and synonyms, when can be used to compare the status after the refresh. in addition of that , I am also trying to get the DDL of db links and synonyms.
    I would appreciate , if you could share with me the document . I actually need to test my synonyms and db links before starting the refresh and after refresh I should also able to compare the status and names of my db links and synonyms.
    DB :- 11.2.03 on Linux
    Regards

    940856 wrote:
    Hi All,
    I am in process of refreshing the one of our test database from other development box. here , I am thinking of creating a table , which would contain the names of name , status of db links and synonyms, when can be used to compare the status after the refresh. in addition of that , I am also trying to get the DDL of db links and synonyms.
    I would appreciate , if you could share with me the document . I actually need to test my synonyms and db links before starting the refresh and after refresh I should also able to compare the status and names of my db links and synonyms.
    DB :- 11.2.03 on Linux
    Regards
    SELECT DBMS_METADATA.GET_DDL

  • Form - Remote DB - Link - Synonym - ORA-00980: synonym translation invalid

    All,
    I have created a PUBLIC LINK AND SYNONYM on a table in a remote DB using the Navigator/Wizard. I then tried to create a FORM using the Wizard. In the Wizard I press enter to FINISH and I receive the error listed below.
    Note I have read and read and re-read all info available to me on the subject. Some posts on MetaLink and these forums suggested that the Link and Synonym made Public - they are as they live in the Public Schema. Another doc stated the "Returning" statement was the problem.
    I have tested this in SQLPLus and it works fine.
    What is the is problem with this and how do I fix it?????
    Thanks,
    Bill G...
    Error creating package PORTAL_DEMO.FORM_1
    Line/Column Error
    242/18 PL/SQL: ORA-00980: synonym translation is no longer valid
    236/65530 PL/SQL: SQL Statement ignored
    284/65 PL/SQL: ORA-00980: synonym translation is no longer valid
    284/28 PL/SQL: SQL Statement ignored
    284/16 PLS-00341: declaration of cursor '_tc' is incomplete or malformed
    290/25 PL/SQL: Item ignored
    321/30 PLS-00320: the declaration of the type of this expression is incomplete or malformed
    321/13 PL/SQL: SQL Statement ignored
    357/38 PLS-00320: the declaration of the type of this expression is incomplete or malformed
    354/13 PL/SQL: Statement ignored
    369/34 PLS-00320: the declaration of the type of this expression is incomplete or malformed
    369/17 PL/SQL: SQL Statement ignored
    380/30 PLS-00320: the declaration of the type of this expression is incomplete or malformed
    380/13 PL/SQL: SQL Statement ignored
    387/38 PLS-00320: the declaration of the type of this expression is incomplete or malformed
    384/13 PL/SQL: Statement ignored
    400/26 PLS-00320: the declaration of the type of this expression is incomplete or malformed
    400/9 PL/SQL: SQL Statement ignored
    464/63 PL/SQL: ORA-00980: synonym translation is no longer valid
    464/26 PL/SQL: SQL Statement ignored

    Yeah, it is pretty simple really. Metalink note 174618.1 covers it. The note is for Rel1, but the same works with Rel2.
    Cut and paste doesnt work well here, but if you cant access the note, I can reformat it and paste it in here.

  • 6i Report Crashes at Synonym using DBLink

    Hello,
    I have a 6i Report, (lets call it repx.rdf) consisting of a data model and no layout.
    It is used to generate xml.
    I have two databases: db1 (with schema jack) and db2 (with schema jill).
    To compile this report, my connection is as follows:
    jack/jack@db1
    In db2 there is a package called:
    pkg_fetch_water
    In the report, i have a line of code as follows:
    pkg_fetch_water.fetch('Y');
    To allow this call, i have created a database link and synonym:
    create public database link jtoj connect to jill identified by jill using 'db2';
    create public synonym pkg_fetch_water for jill.pkg_fetch_water@jtoj;
    In sqlplus, the call to pkg_fetch_water.fetch('Y') works fine.
    When I try to compile the report from Developer 6i, the entire developer crashes.
    I receive no error messages.
    Any ideas what is wrong here?

    There may be nothing wrong. With you or your work, that is.
    However, Reports will crash at the drop of a hat. It is not only unstable, it is not robust, i.e. it can't handle many of the anomolies a program of its age should.
    It doesn't get any better with newer versions, either. Well, that's not quite fair. It gets a little better in v10R2 because it, at least, has a crash recovery feature which saves your work in the background and will recover from that point when Reports is restarted.
    Auto recovery is a wonderful feature. Now if only Oracle would get off its a$$ and begin addressing the fatal memory flaws in Reports.

  • Error while Creating form on remote Database

    Hi All
    I m getting error while creating form on remote database thru
    Database link
    Line/Column Error
    7099/21 PLS-00454: with a returning into clause, the table
    expression cannot be remote or a subquery
    7099/9 PL/SQL: SQL Statement ignored
    7749/16 PLS-00454: with a returning into clause, the table
    expression cannot be remote or a subquery
    7749/9 PL/SQL: SQL Statement ignored
    and statement at line specified is insert statement. and at end
    of insert statement Returning caluse is there as follows
    RETURNING ROWID INTO "_ROWID";
    This returning clause is causing error. Does anybody knows how
    to handel it??
    Thanks
    Yogesh

    Yogesh
    I haven't seen the ora-03116 problem.
    What version of Portal are you running? Are the databases at the same version? Does your table have longs or anything strange in it?
    Can you query the table via the synonyms and link in sqlplus as the application schema? This is a good test because it eliminates Portal.
    You should try setting up synonyms etc for the emp table. If you still get the problem then Oracle may be able to replicate it. If not, then there's sth funny about your table maybe.
    I agree with Vishnu about creating everything in sqlplus. I create all my links and synonyms in sqlplus. They are all public. I have 2 synonyms: one takes you over the link the other takes you to the right schema. It's flexible and it works.
    data database: D grants to P (local schema) on table T
    public syn T = D.T (sys) (get the right schema)
    portal dbase : public db link to data database connecting as P
    public syn T = T@dblink (sys) (over the link)
    P is a schema created in both databases.
    Test is: P in portal dbase can "select * from T" and gets the right data.
    I never, ever refer to a schema when defining a form. ie. never P.T or D.T or whatever. I always refer simply to a synonym. For the above my form would be defined simply on the table T.
    Hope this helps
    Greg

  • Bug in my code or strange memory behavior ?

    Hi, Guys !
    It's been a while since I post something in this forum - trying to use your help when it's really needed.
    So, here we go ...
    (we use Oracle 8.1.7 on Unix box and SQL * Plus 8.1.6)
    While back I wrote "core" PL/SQL package that resides in let's say DB1 database. It has RECORD_EXISTS_FNC function designed to dynamically check If the record exists in certain table/view. Assumptions are that you pass in :
    Table/View name, Column name, and unique numeric value (because by DBA rules all of our Tables have SEQUENCE as a Primary Key. And I plan soon to put in overloaded function to accept unique character value)
    Also every Table has SYS_TIME_STAMP and SYS_UPDATE_SEQuence columns that populated by Trigger before Insert/Update representing Last Update time_stamp
    and how many times record was updated within same second.
    (in case more than one User updates same record in same time - that was written before Oracle had more granular date/time). So function has SYS_TIME_STAMP and SYS_UPDATE_SEQUENCE parameters (optional) accordingly.
    And It looks something like :
    FUNCTION RECORD_EXISTS_FNC
    (iBV_NAME IN USER_VIEWS.VIEW_NAME%TYPE,
    iPK_FIELD IN USER_TAB_COLUMNS.COLUMN_NAME%TYPE,
    iPK_VALUE IN NUMBER,
    iSYS_TIME_STAMP IN DATE DEFAULT NULL,
    iSYS_UPDATE_SEQ IN NUMBER DEFAULT NULL) RETURN BOOLEAN IS
    TYPE REF_CUR IS REF CURSOR;
    CR REF_CUR;
    i PLS_INTEGER DEFAULT 0;
    vRESULT BOOLEAN DEFAULT FALSE;
    vQUERY USER_SOURCE.TEXT%TYPE;
    BEGIN
    vQUERY := 'SELECT 1 FROM ' || iBV_NAME || ' WHERE ' || iPK_FIELD || ' = ' || iPK_VALUE;
    IF iSYS_TIME_STAMP IS NOT NULL AND iSYS_UPDATE_SEQ IS NOT NULL THEN
    vQUERY := vQUERY || ' AND SYS_TIME_STAMP = TO_DATE (''' || iSYS_TIME_STAMP || ''')
    AND SYS_UPDATE_SEQ = ' || iSYS_UPDATE_SEQ;
    END IF;
    IF iBV_NAME IS NOT NULL AND
    iPK_FIELD IS NOT NULL AND
    iPK_VALUE IS NOT NULL THEN
    OPEN CR FOR vQUERY;
    FETCH CR INTO i;
    vRESULT := CR%FOUND;
    CLOSE CR;
    END IF;
    RETURN vRESULT;
    EXCEPTION
    WHEN OTHERS THEN
    IF CR%ISOPEN THEN
    CLOSE CR;
    END IF;
    INSERT_ERROR_LOG_PRC ('CORE_PKG', 'ORACLE', SQLCODE, SQLERRM, 'RECORD_EXISTS_FNC');
    RETURN vRESULT;
    END RECORD_EXISTS_FNC;
    So the problem is when I call this function from let's say
    database DB2 (via db remote link and synonym) and I know exactly that record does exists (because I am selecting those SYS fields before pass them in) - I get the correct result TRUE. The other programmer (Patrick) calls this function within same DB2 database, within same UserID/password (obviously different session), running exactly the same testing code and gets result FALSE (record doesn't exist, but it does !) He tried to Logoff/Login again several times within several days and try to run it and still was getting FALSE !
    I tried to Logoff/Login again and I was getting mostly TRUE and sometimes FALSE too !!!
    I thought may be It has something to do with REF CURSOR that I use to build SQL on the fly, so I changed to NDS
    using EXECUTE IMMEDIATE statement - nothing changed.
    vQUERY := 'SELECT COUNT (1) FROM ' || iBV_NAME || ' WHERE ' || iPK_FIELD || ' = ' || iPK_VALUE;
    IF iSYS_TIME_STAMP IS NOT NULL AND iSYS_UPDATE_SEQ IS NOT NULL THEN
    vQUERY := vQUERY || ' AND SYS_TIME_STAMP = TO_DATE (''' || iSYS_TIME_STAMP || ''') AND SYS_UPDATE_SEQ = ' || iSYS_UPDATE_SEQ;
    END IF;
    EXECUTE IMMEDIATE vQUERY INTO i;
    vRESULT := NOT (i = 0);
    RETURN vRESULT;
    Interesting note : when Patrick doesn't pass SYS parameters (Time_stamp, Update_sequence), or passes NULLs - function always finds the record ! (Statement 2 below)
    May be it has to do with the way TO_DATE () function gets parsed in that dynamic SQL - I don't know ...
    Here's the test code :
    SET SERVEROUTPUT ON;
    DECLARE
    SYS_TIME DATE;
    SYS_SEQ NUMBER;
    bEXISTS BOOLEAN DEFAULT FALSE;
    BEGIN
    SELECT SYS_TIME_STAMP, SYS_UPDATE_SEQ INTO SYS_TIME, SYS_SEQ FROM LOCATION_BV WHERE PK = 1;
    bEXISTS := CORE_PKG.RECORD_EXISTS_FNC ('LOCATION_BV','PK',1, SYS_TIME, SYS_SEQ); -- STATEMENT 1
    --bEXISTS := CORE_PKG.RECORD_EXISTS_FNC ('LOCATION_BV','PK',1, NULL, NULL);        -- STATEMENT 2
    IF bEXISTS THEN
    DBMS_OUTPUT.PUT_LINE ('TRUE');
    ELSE
    DBMS_OUTPUT.PUT_LINE ('FALSE');
    END IF;
    END;
    I asked our DBA, he has no clue about this strange inconsistent results.
    I debugged line by line, extracted that generated SQL and ran it in same account - works fine !
    Does anyone knows or have clues or can help what's going on ???
    I don't know If this is bug in my code or strange memory behavior ?
    (Please let me know If anything unclear)
    Thanx a lot for your help and time !
    Steve K.

    see your other thread
    Bug in my code or strange memory behavior ?

  • Database schema SCM does not contain the associated database objects

    I am getting the following error when i am trying to migrate the form to apex using application migration.
    "*Database schema SCM does not contain the associated database objects for the project, aafs.*
    *Ensure the database schema associated with the project contains the database objects associated with the uploaded Forms Module .XML file(s).* ".
    Actully i am having one schema which i named as SCM, and i have defined one table TT.
    I created one form test.fmb in which i used TT table.its compiled successfully.
    Then i generated the xml file using frmf2xml from fmb file. After that, I created the project in appication migration wizard in SCM schema.
    Project creattion is working fine.but when i m trying to create application,it is showing me above error.
    can any one help in solving this problem.

    Hi Hilary,
    Thanks for your response/feedback.
    1. The schema associated with the project does not contain the necessary objects Can you please verify that the schema associated with your Forms conversion project does in fact contain the objects associated with the uploaded files. Could you also verify that the object names referenced in the error message do not exist within the schema associated with your workspace. Ensure that the schema associated with the project contains the necessary database objects before proceeding to the generation phase of the conversion process.
    Ans:
    Yes it does contain the objects (See results from SQL query Commands below):
    SELECT MWRA_CONTRACT_NO, OLD_CONTRACT_NO FROM PROJECTS@CONTRACT_LX19.MWRA.NET
    ORDER BY MWRA_CONTRACT_NO
    000000569 551TA
    000000570 553TA
    000000575 560TA
    000000576 561TA
    000107888 502TA
    000108498 500TA
    000108502 503TA
    2. The block being converted contains buttons, which may have been incorrectly identified as database columns, and included in the original or enhanced query associated with your block This is a known issue ,bug 9827853, and a fix will be available in our upcoming 4.0.1 patch release. Some possible solutions to this issue are:
    -> delete the buttons before generating the XML
    -> delete the button tags from the XML
    -> add "DatabaseItem=No" for the button in the XML file before importing it in Apex.The button is excluded when creating the Application.
    Ans
    yes it does contain push buttons to transfer to another forms and these are defined as Non data base items. Parial XML code provided below:
    - <Item Name="REPORTS" FontSize="900" DirtyInfo="true" Height="188" XPosition="4409" FontName="Fixedsys" ForegroundColor="black" DatabaseItem="false" Width="948" CompressionQuality="None" YPosition="3709" FontSpacing="Normal" Label="REPORTS" BackColor="canvas" FillPattern="transparent" ShowHorizontalScrollbar="false" FontWeight="Medium" ShowVerticalScrollbar="false" FontStyle="Plain" ItemType="Push Button">
    <Trigger Name="WHEN-BUTTON-PRESSED" TriggerText="GO_BLOCK('REPORT_1');" />
    </Item>
    - <Item Name="TRACKHDR" FontSize="900" DirtyInfo="true" Height="188" XPosition="3409" FontName="Fixedsys" ForegroundColor="black" DatabaseItem="false" Width="948" CompressionQuality="None" YPosition="3709" FontSpacing="Normal" Label="TRACK" BackColor="canvas" FillPattern="transparent" ShowHorizontalScrollbar="false" FontWeight="Medium" ShowVerticalScrollbar="false" FontStyle="Plain" ItemType="Push Button">
    <Trigger Name="WHEN-BUTTON-PRESSED" TriggerText="GO_BLOCK('TRACKHDRS');" />
    </Item>
    - <Item Name="SUBAWRD" FontSize="900" DirtyInfo="true" Height="188" XPosition="2429" FontName="Fixedsys" ForegroundColor="black" DatabaseItem="false" Width="948" CompressionQuality="None" YPosition="3719" FontSpacing="Normal" Label="SUBAWARDS" BackColor="canvas" FillPattern="transparent" ShowHorizontalScrollbar="false" FontWeight="Medium" ShowVerticalScrollbar="false" FontStyle="Plain" ItemType="Push Button">
    3. If you are still experiencing issues, then please create a testcase on apex.oracle.com and update this thread with the workspace details so I can take a look.
    Test case details are given below. It was created per ORACLE for open Service Request Number 3-1938902931 on ORACLE Metalink.
    Workspace: contract4
    username: [email protected] (my email)
    Password: contract4
    Comments:
    For my migration/testing purpose a dabatase link and synonyms have been setup by our ORACLE DBA. Could this be causing this problem?
    Do we know when the fix 4.0.1 patch release will be available?
    Thanks for your help.
    Indra

  • Oracle 9i with Forms6i (having problems with objects)

    I am using Oracle 9i server and dev 6i (forms6i).
    i have a form based on Object tables (including REF's items). when i try to insert update, delete the reocrd in the form, it gives error.
    Insert/Update/Delete failed because of OCI_22132: hexadecimal string does not corresopond to a valid REF.
    when i remove REFs items from form (not from database) then it does all functions (insert,update,delete,query).
    Actually i haved used this form with Oracle 8i and it did all functions(insert,update,delete,query). i am using the same tables and types definations in Oracle 9i but it is not working.
    Note: Insert, Update, Delete, or Query is not being done through forms when using REFs items. Others tools like sql*plus are performing the same actions very well.
    Please help.
    I will be thankful to you.
    M. Faisal.

    Not laughing here. This is a long shot, and I have almost no experience with database links, but could you maybe keep an 8.1.7 server running for the Forms 3 forms, and create database links and synonyms on the 8.1.7 server linking to the data on the 9.2 server?

  • Test a procedure which returns a sys_refcursor

    Hi all,
    Oracle 9i
    Got a simple stand alone procedure which has an input param and an output param, the second of which
    is a ref cursor.
    Can anyone tell me how I can go about testing this from within Pl/SQL (Command line)?
    CREATE OR REPLACE PROCEDURE "LOGMNR"."LM"
    (p_filename in varchar2, p_recordset OUT SYS_REFCURSOR)
    as
    begin
    begin
    dbms_output.put_line('Hello World');
    OPEN p_recordset FOR
    SELECT *
    FROM test_table;
    end;
    end LM;
    Also, and I know this is a huge long-shot. I'm going to be calling this procedure from VB6 (yes I know!), via ADODB, but I'm not
    sure what type to add for the second parameter. Anyone called an Oracle procedure with ADODB which returns a refcursor/result set?
    cmd.Parameters.Append cmd.CreateParameter("p_filename", adVarChar, adParamInput, 255, "c:\test.dat")
    cmd.Parameters.Append cmd.CreateParameter("p_recordset", *???*, adParamOutput, 6000, "")
    Regards
    Dave

    Why don't you just use sqlplus as already suggested
    Re: Test a procedure which returns a sys_refcursor
    SQL> var c refcursor
    SQL> begin
      2      open :c for
      3          select * from
      4              (
      5              select * from all_tab_comments
      6              where owner = 'SYS'
      7              order by (length(comments)) desc nulls last
      8              )
      9          where rownum <= 3;
    10  end;
    11  /
    PL/SQL procedure successfully completed.
    SQL> print c
    OWNER                          TABLE_NAME                     TABLE_TYPE  COMMENTS
    SYS                            USER_AUDIT_OBJECT              VIEW        Audit trail records for statements concerning objects, specificall
    y: table, cluster, view, index, sequence,  [public] database link, [public] synonym, procedure, trigger, rollback segment, tablespace, role,
    user
    SYS                            ALL_JAVA_DERIVATIONS           VIEW        this view maps java source objects and their derived java class ob
    jects and java resource objects  for the java class accessible to user
    SYS                            USER_JAVA_DERIVATIONS          VIEW        this view maps java source objects and their derived java class ob
    jects and java resource objects  for the java class owned by user
    SQL>* Interesting how two out of three of the wordiest comments relate to java.

  • 10g express Exec Imm. Create table problem

    Account is setup as a DBA account in Database (everything granted). I get Insuffiction privelages when running the following stored procedure:
    CREATE OR REPLACE PROCEDURE R02_BLD_RMS_JRNL(
    in_rdate IN DATE)
    AS
    v_sql VARCHAR2(1000);
    BEGIN
    -- Note I took out the variable and hard coded the date to try to get it to run
    -- create load
    v_sql:='CREATE TABLE TEMP_LOAD AS '||
    'SELECT EXPORT_DATE,ACCOUNT,CC,AMOUNT,DR_CR,TX_ID '||
    'FROM RMSA_JOURNAL '||
    'WHERE EXPORT_DATE=''01-AUG-07'' '||
    'AND ROWNUM<11 ';
    EXECUTE IMMEDIATE v_sql;
    EXCEPTION
    WHEN OTHERS THEN
    RAISE;
    END;
    RMSA_JOURNAL is a synonym to a table accross a DB link. Synonym works and I have tried putting in the full name of the table instead of the synonym.
    When I run the following command:
    EXEC R02_BLD_RMS_JRNL('01-AUG-07');
    I get ORA-01031: Insufficient Privileges
    If I run the statement about as a regular PLSQL block (not a stored procedure) it runs with no errors. There has to be some permission missing in relation to creating a table via a stored procedure. I have tried Dropping tables using Execute Immediate in a stored procedure and that works fine.
    Any help would be much appreciated.

    You cannot exercise a granted privilege through a role in a stored procedure, you have to directly received.
    On the other hand, people who post here are just ordinary people who have to perform real work. This is not a work for us, and if there are no posters available it's because they are busy. People here are on a voluntary and altruist basis. We all try to respond as fast as possible, but if our boss has assigned us a task, it has a higher priority than the forum.
    ~ Madrid

Maybe you are looking for

  • Would like to see 5-days in Month View

    I'd like to see 5-days (without Sat/Sun) in Month View, but iCal keeps showing me seven. These are the only two options and for some reason the program won't accept my choice of 5-days in Preferences. A few of my colleagues took a stab at it without

  • Photo Assignment to be Removed for Pers. Numbers

    Dear Friends, I want to remove the link between the employee photos in the archive server to the employee personnel numbers... Because of this assignment, the system is running slow to update master data. Request you to please provide me the solution

  • Please advise regarding implementing pub/sub in a BPEL process.

    Hi guys, Requirement The customer information comes as HTTP/SOAP message and is sent to the BPEL process as input. BPEL uses ESB and database adapters to create the customer in Oracle apps. Now, we need to send the same customer information with the

  • CP1215 Ink Lights Flashing

    This color laserjet has 4 ink cartridges.  The lights for yellow and blue are flashing. It does not allow any more printing even if I only want to print black and white.  Any idea if I can reset the lights.  I`ve tried on off switch.  Thanks

  • HELP!  Can't print from iTunes

    I've had this problem for quite some time now.....a year or two, actually. It has been with me at least since 10.3....if not before. Not to mention several revs of iTunes itself. For some reason I am not able to print anything from iTunes. When I sel