ORA-06504: PL/SQL: Return types of Result Set variables or query do not mat

Hello.
I am trying to assign a weak type ref cursor to a strong type ref cursor. I call a procedure that executes a query using a SYS_REFCURSOR passed in as an IN OUT argument. After the procedure executes, I assign the passed in ref cursor to a strong type ref cursor in the calling procedure. I have found that if I use a static SQL statement in the procedure, the process works, but if I use a dynamic SQL statement in the procedure, I get the error message noted in the subject.
I am running Oracle 9i on Solaris.
Thanks for any thoughts on the matter.

Thanks Bob,
The Package spec part was created successfully.
I am still confused about fetching records though.
You said that 'Select Statement will populate the ref cursor.'
But I do not have
OPEN FOR
SELECT
INTO
FROM
I simply open o_cur_var
select from several tables where........
and then I am using FETCH statement.
What's a better approach?
How should I fetch values of o_cur_var?
If I use SELECT INTO, should I use records that I declared in the package o_cur_type (..........)?

Similar Messages

  • How to return two XML result sets using the function

    Hi Experts,
    Thanks.

    So that I want to return two XML result sets if the query returns more than 50,000 records.
    One XML result set with 50,000 and another XML result set with remaining records.
    How to incorporate this in my function.
    Have the function return a collection of CLOB then.
    DBMS_XMLGEN can handle pagination so it's easy to adapt your existing code.
    Here's an example fetching data in batches of max. 3 rows each, using a pipelined function :
    SQL> create or replace type clob_array is table of clob;
      2  /
    Type created
    SQL>
    SQL> create or replace function genXmlRowset (p_deptno in number) return clob_array pipelined
      2  is
      3    ctx    dbms_xmlgen.ctxHandle;
      4    doc    clob;
      5  begin
      6 
      7    ctx := dbms_xmlgen.newContext('SELECT empno, ename FROM scott.emp WHERE deptno = :1');
      8    dbms_xmlgen.setBindValue(ctx, '1', p_deptno);
      9    dbms_xmlgen.setMaxRows(ctx, 3);
    10 
    11    loop
    12 
    13      doc := dbms_xmlgen.getXML(ctx);
    14      exit when dbms_xmlgen.getNumRowsProcessed(ctx) = 0;
    15      pipe row (doc);
    16 
    17    end loop;
    18 
    19    dbms_xmlgen.closeContext(ctx);
    20 
    21    return;
    22 
    23  end;
    24  /
    Function created
    SQL> set long 5000
    SQL> select * from table(genXmlRowset(30));
    COLUMN_VALUE
    <?xml version="1.0"?>
    <ROWSET>
    <ROW>
      <EMPNO>7499</EMPNO>
      <ENAME>ALLEN</ENAME>
    </ROW>
    <ROW>
      <EMPNO>7521</EMPNO>
      <ENAME>WARD</ENAME>
    </ROW>
    <ROW>
      <EMPNO>7654</EMPNO>
      <ENAME>MARTIN</ENAME>
    </ROW>
    </ROWSET>
    <?xml version="1.0"?>
    <ROWSET>
    <ROW>
      <EMPNO>7698</EMPNO>
      <ENAME>BLAKE</ENAME>
    </ROW>
    <ROW>
      <EMPNO>7844</EMPNO>
      <ENAME>TURNER</ENAME>
    </ROW>
    <ROW>
      <EMPNO>7900</EMPNO>
      <ENAME>JAMES</ENAME>
    </ROW>
    </ROWSET>
    SQL>
    (and don't forget to use bind variables in your query)

  • Conversion away from column type may result in sub-optimal query plan

    Hello all,
    I have the following select statement in a cursor compiled in a package.
    SELECT id
    FROM table
    WHERE TRUNC(ts) >= TRUNC(SYSDATE - p_days)
    However I get 4 warnings that read:
    PLW-07204: conversion away from column type may result in sub-optimal query plan
    Does anyone know of a way to rewrite the query to avoid the compilation warnings?
    I'm just trying to compare the date without the time...
    Thanks in advance
    Dan

    For what it is worth, whenever you compare a date column to either sysdate or any built-in function returning a date you will get that warning.
    SQL> desc t
    Name                                      Null?    Type
    ID                                                 NUMBER
    DT                                                 DATE
    SQL> SELECT DUMP(dt), DUMP(trunc(dt)), dump(sysdate)
      2  FROM t;
    DUMP(DT)                            DUMP(TRUNC(DT))                  DUMP(SYSDATE)
    Typ=12 Len=7: 120,107,7,12,15,16,43 Typ=13 Len=8: 7,215,7,12,0,0,0,0 Typ=13 Len=8: 7,215,7,12,14,16,11,0But,
    SQL> CREATE FUNCTION f(p_v IN VARCHAR2) RETURN DATE AS
      2  BEGIN
      3     RETURN TO_DATE(p_v, 'dd-mon-yyyy');
      4  END;
      5  /
    Function created.
    SQL> SELECT DUMP(f('01-jan-2000')) FROM dual;
    DUMP(F('01-JAN-2000'))
    Typ=12 Len=7: 120,100,1,1,1,1,1John

  • Stored procedure that returns a cursor (result set)

    Hi,
    We have a stored procedure that returns a cursor (result set) but when I compliled it and catalouged (introspected) it in the OBPM I got all the primitive type parameters (either IN or OUT) in the proc call except the cursor type (the result set) which is the out param of the stored proc.
    Any pointers please?
    Thanks

    Result set is of RowType and is not supported as a Stored Procedure as far as I know.
    HTH
    Sharma

  • ORA-06502: PL/SQL: numeric or value error: raw variable length too long

    Hi All,
    Oracle 9.2.0.1.0 and Oracle 10g.
    I the following procedure:
    CREATE OR REPLACE TYPE Resource_TT AS TABLE OF RAW(16)
    CREATE OR REPLACE PROCEDURE GET_ROLEMAPPING_Temp
    RoleIds IN NVARCHAR2 DEFAULT NULL ,
    Application IN NVARCHAR2 DEFAULT NULL ,
    MappingExixts OUT NVARCHAR2
    AS
         v_Application NVARCHAR2(150) := Application;
         resource_list CONSTANT Resource_TT := Resource_TT(RoleIds);
         v_temp NUMBER(1, 0) := 0;
    BEGIN
         SELECT 1 INTO v_temp
    FROM DUAL
    WHERE EXISTS ( SELECT SecurityGroupId
    FROM SKESGResourceMapping
    WHERE APPLICATION = v_Application
    AND RoleId IN                
                                                      select column_value
                                                      from table(resource_list)
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    MappingExixts := 'NO';
    END;
    IF v_temp = 1 THEN
    MappingExixts := 'YES';
         END IF;
    END;
    while calling the procedure from sql*plus, the calling block is :
    variable MappingExixts nvarchar2(100);
    execute Get_RoleMapping_Temp('2f90e7969e0a9045aeb5b5ed7b3da9d6,363aef470e10094281e5040627e3b6f8', 'repo1', :MappingExixts);
    print MappingExixts;
    It is throwing an error saying:
    ORA-06502: PL/SQL: numeric or value error: raw variable length too long
    ORA-06512: at "ORACLE1.GET_ROLEMAPPING_TEMP", line 8
    Thanks for your valuable time and suggestions

    Hi Binoy,
    Thanks for your quick response, I increased its size to 200, but I am getting the following error
    ORA-06502: PL/SQL: numeric or value error: hex to raw conversion error
    ORA-06512: at "ORACLE1.GET_ROLEMAPPING_TEMP", line 8

  • DiscoverSQL2005DBEngineDiscovery.vbs : The Query 'select * from __NAMESPACE where Name ='ComputerManagement'' returned an invalid result set.

    hi
    I am keep receiving this message in central administration running server in event viewer
    DiscoverSQL2005DBEngineDiscovery.vbs : The Query 'select * from __NAMESPACE where Name ='ComputerManagement'' returned an invalid result set.  Please check to see if this is a valid WMI Query.. Object required
    adil

    Hi adil,
    It seems to be not related to SharePoint issue, I find a similar error post from Operations Manager forum you can take a look
    Also another below article of basic troubleshooting of discovery scripts for your reference.
    And for the further better assistance regarding this issue, you may want to post Operations Manager forum here.
    http://social.technet.microsoft.com/Forums/systemcenter/en-US/21e9de85-5cbc-4217-8d9b-921e13dc88dc/sql-mp-issues-with-discovery-vbs-scripts?forum=operationsmanagermgmtpacks
    http://blogs.technet.com/b/kevinholman/archive/2010/03/09/basic-troubleshooting-of-discovery-scripts.aspx
    Thanks
    Daniel Yang
    TechNet Community Support

  • PLW-07204: conversion away from column type may result in sub-optimal query

    I have the following query in the package that created using sql developer. I am receiving the error 'PLW-07204: conversion away from column type may result in sub-optimal query plan' when try to compile the package. The issue is happen to be in the last line where the date is. Any help? Thanks
    select count(*) into n_cnt
    from tmp_order
    where sgn_off_dt is null and cmt_dt is not null
    and sysdate - cmt_dt > 90;

    Sy:
    Try doing as a procedure instead of an anonymous block. It looks like warnings do not apply to blocks.
    SQL> create table tmp_order(sgn_off_dt date,cmt_dt date);
    Table created.
    SQL> alter session set plsql_warnings='ENABLE:ALL';
    Session altered.
    SQL> create procedure p as
      2     n_cnt number;
      3  begin
      4     select count(*) into n_cnt
      5     from tmp_order
      6     where sgn_off_dt is null and
      7           cmt_dt is not null and
      8           sysdate - cmt_dt > 90;
      9  end;
    10  /
    SP2-0804: Procedure created with compilation warnings
    SQL> show err
    Errors for PROCEDURE P:
    LINE/COL ERROR
    8/18     PLW-07204: conversion away from column type may result in
             sub-optimal query planlindalop:
    In this case, you can ignore the warning, as it is not correct. Sysdate and a date column have different internal data types (note the type 13 for sysdate and type 12 for the date column), and whatever internally generates the warnings seems to just compare the type number.
    SQL> insert into tmp_order values(sysdate, sysdate);
    1 row created.
    SQL> commit;
    Commit complete.
    SQL> select dump(sysdate) sdate, dump(cmt_dt) cmt_dt from tmp_order;
    SDATE                             CMT_DT
    Typ=13 Len=8: 7,219,2,3,15,44,4,0 Typ=12 Len=7: 120,111,2,3,16,44,12However, Oracle is perfectly capable of using an index on a date column with sysdate as a predicate. I would agree with Sy's suggestion to re-work the predicate to be something like cmt_dt < sysdate - 90.
    John

  • How to export result set from mysql query browser to .sql in oracle

    Hi folks:
    I was trying to export result set from MySql query browser to Oracle. I could able to do
    File->Export Result Set-> Excel format...
    What I am trying to get is .sql file so that I can run it as a script in my oracle db. Is there any way we can get .sql file with inserts and delimeters ....?
    Did you guys get my question.?
    Please throw some light on this....
    Could be very appreciable ....
    Thanks
    Sudhir Naidu

    Hi
    Create a sql statement which generates the insert statements.
    Something like this:
    select 'insert into table1 (column1, column2, column3) values (' ||
    column1 || ', ' || column2 || ', ' || column3 || ');' from table 1;
    The || sign is the string concatenation sign in Oracle, replace it the appropriate sign in MySql. Export the result set of this query into a file, and you can run it in a SqlPlus.
    Ott Karesz
    http://www.trendo-kft.hu

  • Virtual column in the result set of the query.

    Hi folks,
    I have table , let it be, EMP. It has columns ENAME,EMPNO,JOB etc.,
    My requirement is to add an extra column, not present in the table, having NULL value at the time of diplaying the results of a query. I hope you got it. So a column that does not exists in the table should get displayed in the resultant set when we query the results from that table. so my question is, how to write the SELECT statement using that virtual column.
    I'd thought of using X column in Dummy table but what if I don't have any dummy table in my particular schema.
    Please do revert back with the solution.
    Your effort'll be genuinely appreciated.
    Cheers
    PCZ

    Hi,
    If you just wany display null values you can write query like this :
    SELECT ENAME,EMPNO,JOB , NULL DUMMY_COLUMN FROM emp;
    Regrads
    Avinash

  • Display Image in Report Colum,  ORA-06502: PL/SQL whe column format is set

    Hi @all
    i created a small table
    CREATE TABLE my_sal201 (
    grafikdid VARCHAR2(38) NULL,
    grafik BLOB NULL,
    mimetype VARCHAR2(255) NULL
    then i inserted one column with a page process
    BEGIN
    IF (:p6_filename IS NOT NULL)
    THEN
    INSERT INTO my_sal201
    (grafikdid, grafik, mimetype)
    SELECT meb_ora.mkdid(), blob_content, 'image/gif'
    FROM wwv_flow_files
    WHERE NAME = :p6_filename;
    DELETE wwv_flow_files
    WHERE NAME = :p6_filename;
    :p6_filename := NULL;
    END IF;
    END;
    after that i want to show the columns and the image in a report. so i created a report in a new region quite similar to the example in the obe
    it works fine, the image columns is shown as "[datatype]"
    whenever i change the format of the image colum of the report to
    DOWNLOAD:MY_SAL201:GRAFIK:GRAFIKDID::::::inline:Herunterladen
    (just one example, IMAGE:... does not work as well)
    no more rows are shown but the error h3. "ORA-06502: PL/SQL: numerischer oder Wertefehler: Fehler beim Konvertieren von Zeichen zu Zahl"
    what did i do wrong?
    gretz
    peter

    i'm to silly to work with images :-ß
    i did copy ur example to another app on http://apex.oracle.com/pls/otn/. fine->igames are shown.
    on a new page in my local app, i did exactly the same (create a table, procedure, ect) it does not work.
    rows are shown inthe report, but no images, instead the icon for a broken/missing image is displayed.
    i tried to debug using firebug:
    in the sample app on otn, when i point the mnouse over the procedure call, the image appears in a tool-tip
    in my app, the code is quite simmilar, nothing happens. no icon
    >
    <img width="50" height="50" src="WMF_GL_INTMAN001.DISPLAY_IMAGE?inID=1"/>
    >
    help!!!
    maybe this is important: i'm using apex 3.2.0.00.27 on db version 11g
    Edited by: yeti on 28.08.2009 13:37

  • Can I pass parameters to a subquery to return a narrow result set?

    Hi-
    HERE'S WHAT I'M TRYING TO DO:
    Create a worksheet to aggregate the data that's returned from a subquery result set based on the user's specified date ranges.
    HERE'S MY PROBLEM:
    Discoverer is aggregating the data FOR EACH PARTICULAR DATE that shows up (ie-6/1, 6/2, 6/3) instead of across the entire specified date range (ie- 6/1-6/3) because the date parameters can only be applied to the main query instead of the subquery.
    In essence, I need to:
    SELECT location1, task1, sum(product1), max(product2)
    FROM
    (SELECT * FROM table1 WHERE date1 >= userSpecifiedDate1 and date1 <= userSpecifiedDate2)
    GROUP BY location1, task1
    ...but using Discoverer's "Parameters" and "Totals" tool, so far I can only get Discoverer to do this :
    SELECT location1, task1, sum(product1), max(product2), sum(product3)
    FROM
    (SELECT * FROM table1)
    WHERE date >= userSpecifiedDate1 and date <= userSpecifiedDate2
    GROUP BY location1, task1
    Is there any way to apply date parameters to the subquery first so I'm aggregating across the range and not on each date?
    Hope this makes sense. Any suggestions would be appreciated!

    Hi,
    Yes.
    You can pass parameter from search criteria to procedure.
    First u need write a method in the AmImpl java class to call the procedure.
    Like
    public void callingProcWithinParams(String sreachCriterParam)
    //pass the parameter to proc
    Then shuttle this method to client interface.

  • Error in result set from join query

    I get a SQL exception from the JDBC thin driver when I make a getXXX( "string" ) call on a result set object when the query is a join. Aliases don't seem to help.
    Below is the stack trace.
    Anybody have any ideas?
    matt
    ResultSet.findColumn
    java.sql.SQLException: Invalid column name: get_column_index
    at oracle.jdbc.dbaccess.DBError.check_error(DBError.java:427)
    at oracle.jdbc.driver.OracleStatement.get_column_index(OracleStatement.java, Compiled Code)
    at oracle.jdbc.driver.OracleResultSet.findColumn(OracleResultSet.java:680)
    at person.PersonMgr.getForEdit(PersonMgr.java:114)
    at person.PersonMgr.getForView(PersonMgr.java:168)
    at person.PersonMgr.getPersonForView(PersonMgr.java:164)
    at nwsession.NWSession.login(NWSession.java:224)
    at jsp.dologin._jspService(dologin.java:241)
    at com.livesoftware.jsp.HttpJSPServlet.service(HttpJSPServlet.java:31)
    at com.livesoftware.jsp.JSPServlet.service(JSPServlet.java:129)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:840)
    at com.livesoftware.jrun.JRun.runServlet(JRun.java, Compiled Code)
    at com.livesoftware.jrun.JRunGeneric.handleConnection(JRunGeneric.java:116)
    at com.livesoftware.jrun.service.proxy.JRunProxyServiceHandler.handleRequest(JRunProxyServiceHandler.java, Compiled Code)
    at com.livesoftware.jrun.service.ThreadConfigHandler.run(ThreadConfigHandler.java, Compiled Code)

    Your reference to NS.REQDATE is too deep. Oracle will only allow you to reference a column from the main query one level deep.
    I think you can just change that query into this:
    (Select AVG(((cpath.REQUESTDATETIME)- NS.REQDATE)*1440) AvgTime
    FROM usersessiondetails cpath
    Where cpath.Userkey=(Select Userkey from ods_user where userid=NS.UserId and namespace=NS.Namespace)
       and cpath.acctnum=aCCTNUM
       and cpath.transactionname IN (AUTH_LOGOFF' )
       and cpath.REQUESTDATETIME = NS.REQDATE )You do not need the extra query level to do the AVG.

  • JZ0R2 -- No result set for this query

    hi,
    I'm using this code to update records in the database:
    facsk = myArray[ctr];
    query = 'excute dp_autogeo_accept" + facsk;
    stmt.executeQuery(query);
    No records are returned so I'm not sending anything to a result set or trying to read the next string. I get this error: JZ0R2: No result for this query. I'm not sure why the original developer chose to use executeQuery but I've also tried stmt.updateQuery and got this error.
    Can someone help me?

    hi,
    I'm using this code to update records in the
    database:
    facsk = myArray[ctr];
    query = 'excute dp_autogeo_accept" +
    _accept" + facsk;
    stmt.executeQuery(query);
    No records are returned so I'm not sending anything
    to a result set or trying to read the next string. I
    get this error: JZ0R2: No result for this
    query. I'm not sure why the original developer
    chose to use executeQuery but I've also tried
    stmt.updateQuery and got this error.
    Can someone help me?when you're executing a query that has no result set use stmt.executeUpdate() instead of stmt.executeQuery()

  • How to get previous row of result set in select query?

    I want to access the previous row of an result set obtained yet, in the same selectquery .
    How can I do that?

    Use analytical functions.
    For example:
    create table top_n_test (
       a number,
       b varchar2(10)
    insert into top_n_test values (1,   'one');
    insert into top_n_test values (2,   'two');
    insert into top_n_test values (3, 'three');
    insert into top_n_test values (4,  'four');
    insert into top_n_test values (5,  'five');
    insert into top_n_test values (6,   'six');
    insert into top_n_test values (7, 'seven');
    insert into top_n_test values (8, 'eight');
    insert into top_n_test values (9,  'nine');
    commit;
    select a, b from (
      select
        a,b,
        rank() over (order by b) r
      from
        top_n_test
    where
      r<4;
             A B
             8 eight
             5 five
             4 fourHTH
    Ghulam

  • How to Colour the fields in the Result Set of the query

    Hi all,
    I am having a requirement wher the user want to view the queries results with some colour to the char in the result set.
    suppose customer is the row he want to view some customers with one color and some with different color.
    Is it possible in Bi.
    If so Plz let me know
    Regards

    Hi Priya,
    for the macro thing, you will have to create a workbook and store your query into it, because macros are attached to only workbooks and not queries.
    in the workbook screen (i.e. excel), go to tools --> Macro --> Visual Basic Editor. or simply press Alt + F11. this will take you to macro editor screen.
    you can use code that may look something like below to color the columns, you can also give constant column if they are fixed.
    sub ColorColumns(rngTarget As Range, _
        intColor As Integer)
    Dim c As Long
        With rngTarget
            .Interior.ColorIndex = intColour
            Next c
        End With
    End Sub
    You will find some easy and short snippets for this.
    Regards,
    Purvang

Maybe you are looking for

  • Can't install Win 8 - Satellite Pro C660 does not detect HDD

    Hello, My HDD has died, so i decided to upgrade my Satellite Pro C660-1D9 to an SSD. I made a bootable USB with Win8, and booted just fine. The problem is that it does not detect my SSD so i can proceed with the install. SSD shows up in BIOS, but not

  • SAP Work Manager 6.0 Query

    Hi Experts, Can somebody tell me what BAPIs run in background when transmitting a Work Order from SAP Work Manager WPF Client to ECC? Also, what post installations are required after installing Work Manager? All I have done are the following: /SMERP/

  • Start routine for base unit

    hi friends i need to give a start routine  for my baseunit. i need my baseunit always EA, i get the data from the flat file , so what ever the unit they mention there in the flat file if it is not equal to 'EA',  then it should take it as EA. i gave

  • Decimal Values in print formats

    Hi All, I had set 4 as value for amounts and quantity after decimal in Genaralsetting but in print formats i need only 2 values after decimals. I thinlk for this some caliculations are there please give me solution Regards Srinivas

  • SAP Permormance on Sun T2000 multi core servers.

    Hi guys, On some of the newer sun servers, the performance isn't quite as good as what you would expect. When you are running a specific job, let say patching using saint for instance the process works as expected, but the disp+work process seems to