PL/SQL: ORA-22806: not an object or REF  when Using Record in Package

Oracle Database 11g Enterprise Edition Release 11.1.0.7.0
I have declared a record type in my package
create or replace
PACKAGE MYPKG AS
  TYPE MYREC IS RECORD (VAL1 varchar2(20), val2 date);
  PROCEDURE display_error (pSQLERRM number);
  PROCEDURE P_LOAD_DATA (pStartDate Date, pEndDate Date);
  FUNCTION  F_EPI(refno1 in NUMBER,  refno2 in NUMBER) return MYREC;
END MYPKG;
--In My Package Body
FUNCTION  F_EPI(refno1 in NUMBER,  refno2 in NUMBER) return MYREC is
        F_param MYREC;
        BEGIN
        select myvarchar2, mydate into MYREC from MYTable
          where myrefno1 = refno1
          and myrefno2 = refno2
        Exception
          when others then
          display_error(SQLERRM);
          RETURN F_param;
        END F_EPI ;
  PROCEDURE P_LOAD_DATA (pStartDate Date, pEndDate Date) IS
insert into atable(myvarchar, mydate)
select F_EPI(refno1,refno2).val1,F_EPI(refno1,refno2).val2 from tab2;
END P_LOAD_DATA;
I get errors
Error(187,7): PL/SQL: SQL Statement ignored
Error(225,7): PLS-00382: expression is of wrong type
Error(225,7): PL/SQL: ORA-22806: not an object or REF
When I compile the package.
When I try to call the function from SQL I get an Invalid datatype error.

Hi,
Before posting any query/plsql blocks, please ensure that you have written it clean and complete with less syntax errors. ( at least general syntax errors, you can avoid). Then somebody can have an interest to check your logical error.
About your posting, refer below solution step-by-step. It may help you, about what you are looking for? By the way, you must be knowing, what you are going to to do with. I haven't concentrated about your requirement; as it was not missing in your posting.
drop table test;
create table test(myvarchar varchar2(20), mydate date);
create or replace
    package mypkg as
      type myrec is record (val1 varchar2(20), val2 date);
      --procedure display_error (psqlerrm in number); -- if you are passing sqlerrm, then parameter needs to be string type
   procedure display_error (psqlerrm in varchar2);
      procedure p_load_data (pstartdate in date, penddate in date);
      function  f_epi(refno1 in number,  refno2 in number) return myrec;
   end mypkg;
Package created.
--in my package body
create or replace 
package body mypkg as -- added
procedure display_error (psqlerrm in varchar2) -- if you are declared a proc/func in spec, it needs to define in pkg body
is
begin
     null; -- you should know, what to do here
  dbms_output.put_line('Err -'||sqlerrm);
end display_error;
function  f_epi(refno1 in number,refno2 in number)
return myrec
is
f_param myrec;
begin
   -- select myvarchar2, mydate into MYREC from mytable
  --  where myrefno1 = refno1
  --  and myrefno2 = refno2;
    select ename, hiredate into f_param from emp -- added demo logic by using emp
    where empno = refno1
     and  mgr  = refno2;
    return f_param;  -- added
exception
   when others then
     raise; -- if you are using OTHERS then, just raise it
   display_error(sqlerrm);  
   --return f_param; -- what is this?
end f_epi;
procedure p_load_data (pstartdate in date, penddate in date) -- you must be knowing the use of 2 params ???
is
    v_rec myrec; -- added
begin -- Added
   --insert into atable(myvarchar, mydate)
  -- select f_epi(refno1,refno2).val1,f_epi(refno1,refno2).val1 from tab2;
   -- demo logic added with static params to call f_epi
   v_rec:= f_epi(7499,7698);
   insert into test values v_rec;
    --null; 
end p_load_data;
end mypkg;
Package body created.
SQL> exec mypkg.p_load_data(null,null);
PL/SQL procedure successfully completed.
SQL> select * from test;
MYVARCHAR            MYDATE
ALLEN                20-FEB-81
Thanks!

Similar Messages

  • ORA-22806: not an object or REF on the reserved word FROM, how to debug?

    I am honestly confused on this one...
    When I run the following in sqlplus:
    SQL> SELECT a.fname, a.lname
    FROM h_user_m a
    WHERE a.id IN
    (SELECT UNIQUE m.user_id
    FROM h_user_role m
    WHERE m.role_id =
    (SELECT UNIQUE id
    FROM h_role_n
    WHERE LOWER (name) = 'wc-ismp-admin')
    OR m.role_id =
    (SELECT UNIQUE id
    FROM h_role_n
    WHERE LOWER (name) = 'wc-ismp-user'))
    AND a.id NOT IN (SELECT user_id
    FROM ip_user);
    ERROR at line 2:
    ORA-22806: not an object or REF
    I run the same query in Toad for Oracle v9.7.2.5 and it returns the same error, but highlights the reserved word FROM. I googled the error, but I'm not for sure why the reserved word FROM would be causing the error?

    Thank you for the quick response.
    I tried your query and I still receive the same 'ORA-22806: not an object or REF' error & in Toad, it does highlight the reserved word FROM.
    Oddly enough, I went back and ran the first sub-query from both of our SQL statements and no errors returned.
    Only when I added the sub-query back to the main query I receive the error as mentioned.
    So, the following worked:
    select m.user_id
    from h_user_role m
    where m.role_id in
    (select id
    from h_role_n
    where lower (name) = 'wc-ismp-admin'
    or lower (name) = 'wc-ismp-user'
    minus
    select user_id
    from ip_user)
    but added back to:
    select a.fname, a.lname
    from h_user_m a
    where a.id in(...)
    The error returns - the same steps apply to my statement as well...
    Looking at the 10g Release 2 (10.2) documents, I don't see any restrictions to the IN reserved word, in terms of number of sub-queries, etc...

  • ORA-22806: not an object or REF

    Hi!
    My query encountered error:ORA-22806: not an object or REF.
    select LOGINNAME from (
    select ID_.LOGINNAME
    from TEST_IDENTIFICATIONDEVICE ID_
    join TEST_CONTRACTPARTNER CP
    on (CP.ID=ID_.ID_PERSON)
    join TEST_CONTRACT gc on (gc.ID_PARTNER=CP.ID)
    inner join car_reflists cr on (EXTRACTVALUE(gc.XMLEXTENSION,'/data/shop-identification')
    = cr.listitemid)
    where loginname like '%pos%'
    But inlined SELECT works Ok. Please help me to solve this problem. Thank you in advance.

    Is any of the object in "inlined SELECT" a view? Is the view doing another EXTRACT?

  • ORA-22806 not an object or REF, Query for XMLType

    Hi,
    i am using this query :
    select centre||compte, sum(cout) from (
    SELECT o.INDICE_CENTRE as centre, substr(o.champs.extract('//compte/text()').getStringVal(),1,8)
    as compte,to_number(substr(o.champs.extract('//cout/text()').getStringVal(),1,17)) as cout
    FROM canevas o)
    group by centre||compte;
    i have got this error ORA-22806 not an object or REF.
    any sugestion please?

    Problem resolved.

  • ORA-22806 : not an object or reference in 10gRel2

    Hi,
    We have recently successfully upgraded our oracle 8i database to 10.2.0.1
    database is up and running fine, but
    one of the user created procedure is giving error as below :
    ORA-22806 : not an object or reference
    See the below code :
    =============
    v_cnt:=0;
    Check_Str := 'SELECT COUNT(*) FROM P_EMP_HOLIDAY_DATE
    WHERE company_id=:p_Comp_id
    AND branch_id = :rec_branch.branch_id
    AND employee_id =:rec_emp.employee_id
    AND :v_nxt_date IN holiday_date';
    EXECUTE IMMEDIATE Check_Str INTO v_cnt USING p_Comp_id,rec_emp.branch_id, rec_emp.employee_id,v_nxt_date;
    Put_Any_Line('v_cnt : ' || v_cnt);
    when we run the procedure it gives the error at line 186 .i.e the line with EXECUTE IMMEDIATE statement in above
    so where is the problem ?
    this procedure was running fine without any problem in our oracle 8.1.7.0 version now showing error in 10.2.0.1
    is there any syntax problem that is not being suported in the upgraded version i.e. 10.2.0.1
    how to get it solved ?
    As this is very urgent to solve so any immediate support would be appreciated.
    with regards

    What is Put_Any_Line ? Why are you using dynamic sql here ?
    As this is very urgent to solve so any immediate support would be appreciated.Ok, then please, do not hesitate to use the Oracle support, and see how it can be immediate support.
    Nicolas.

  • ERROR in PROCEDURE  PL/SQL: ORA-00947: not enough values

    Hi all i am creating a Procedure in which i am getting very strange ERROR
    h4. i am using Oralce 11g, SQL Developer 3
    my scenario is :
    CREATE SEQUENCE tt_TMPMEASURESOURCE_ID
    START WITH 1
    INCREMENT BY 1;
    CREATE TABLE tt_TMPMEASURESOURCE
    ID NUMBER(10,0) ,
    OBJNAME VARCHAR2(200) ,
    PRSP NUMBER(10,0) ,
    SOURCEID NUMBER(10,0) ,
    SOURCENAME VARCHAR2(100) ,
    FIX NUMBER(3,0) ,
    MNAME VARCHAR2(1000) ,
    MDESC VARCHAR2(1000)
    CREATE OR REPLACE TRIGGER tt_TMPMEASURESOURCE_ID_TRG
    BEFORE INSERT
    ON tt_TMPMEASURESOURCE
    FOR EACH ROW
    BEGIN
    SELECT tt_TMPMEASURESOURCE_ID.NEXTVAL INTO :NEW.ID
    FROM DUAL;
    END;
    INSERT INTO TT_TMPMEASURESOURCE
    *(OBJNAME,PRSP,SOURCEID,SOURCENAME,FIX,MNAME,MDESC)*
    values ('rajnish',43,54,'anish',4,'apple','kumar');
    output :
    +1 row inserted+
    h4. select * from TT_TMPMEASURESOURCE;
    h3. 1     rajnish     43     54     anish     4     apple     kumar
    creating and compiling Procedure
    create or replace procedure tem_test
    as
    begin
    INSERT INTO tt_TmpMeasureSource
    *(OBJNAME,PRSP,SOURCEID,SOURCENAME,FIX,MNAME,MDESC)*
    VALUES ( v_ObjName, v_PrespectiveID, v_SourceID, v_SourceName, v_FIX, v_MName, v_MDesc );
    when compiling
    Error(63,16): PL/SQL: SQL Statement ignored
    Error(63,28): PL/SQL: ORA-00947: not enough values
    i am do not understand that when Trigger A trigger is allready there for 1st column
    then why its giving me this error?
    please help me out
    thanks

    i got my solutions
    creating and compiling Procedure
    create or replace procedure tem_test
    as
    begin
    INSERT INTO tt_TmpMeasureSource
    *(OBJNAME,PRSP,SOURCEID,SOURCENAME,FIX,MNAME,MDESC)*
    VALUES ( v_ObjName, v_PrespectiveID, v_SourceID, v_SourceName, v_FIX, v_MName, v_MDesc );
    it was a typography mistake
    this line was missing in Original procedure
    *(OBJNAME,PRSP,SOURCEID,SOURCENAME,FIX,MNAME,MDESC)*thanks

  • Get ORA-01031: insufficient privileges error, but only when using dbstart.

    I am getting ORA-01031: insufficient privileges error, but only when using dbstart. the listener starts but not the database. How come I can start it from SQL prompt but not from dbstart scripts as the oracle user?
    [oracle@mallard bin]$ ./dbstart
    Processing Database instance "gf44": log file /prod/oracle/10/startup.log
    [oracle@mallard bin]$
    Log file:
    Wed Aug 20 10:15:02 CDT 2008
    SQL*Plus: Release 10.2.0.1.0 - Production on Wed Aug 20 10:15:02 2008
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    SQL> ERROR:
    ORA-01031: insufficient privileges
    SQL> ORA-01031: insufficient privileges
    SQL>
    /prod/oracle/10/bin/dbstart: Database instance "gf44" warm started.
    >
    oratab file:
    gf44:/prod/oracle/10:Y
    dbstart file section:
    # See if it is a V6 or V7 database
    VERSION=undef
    if [ -f $ORACLE_HOME/bin/sqldba ] ; then
    SQLDBA=svrmgrl
    VERSION=`$ORACLE_HOME/bin/sqldba command=exit | awk '
    /SQL\*DBA: (Release|Version)/ {split($3, V, ".") ;
          print V[1]}'`
    case $VERSION in
    "6") ;;
    *) VERSION="internal" ;;
    esac
    else
    if [ -f $ORACLE_HOME/bin/svrmgrl ] ; then
    SQLDBA=svrmgrl
    VERSION="internal"
    else
    SQLDBA="sqlplus /nolog"
    fi
    fi
    Permissions of file:
    [oracle@mallard bin]$ ls -la dbstart
    -rwxrwxr-x 1 oracle oinstall 10407 Aug 19 12:27 dbstart
    [oracle@mallard bin]$
    User permissions:
    [root@mallard 10]# id oracle
    uid=503(oracle) gid=503(oinstall) groups=503(oinstall),504(dba)
    [root@mallard 10]#
    I can start the listener manually using "./lsnrctl start" and start the database manually from sql prompt using "SQL>startup" (as sysdba) with no problems. this only happens when using dbstart file. I am logged in as oracle user and all environment variables are set
    Thank you for any help you could provide.

    I have the same problem, but i don't want insert this string
    Connect sys/{password} as sysdbaI have deployed an Oracle 10g with os SunOS
    $ uname -a
    SunOS DB02 5.10 Generic_141444-09 sun4v sparc SUNW,Sun-Blade-T6320
    I can connect with sys/password, but I can't login with
    $ sqlplus /nolog
    SQL*Plus: Release 10.2.0.1.0 - Production on Thu Jan 7 15:19:50 2010
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    SQL> connect / as sysdba
    ERROR:
    ORA-01031: insufficient privilegesthe the startup and dbshut don't work.
    Someone maybe help me?
    Thanks,
    Regards.
    Lain

  • Drop down menus on iPad, the first selection in the drop down will not load as a selection when using safari, what can I do?

    Drop down menus on iPad, the first selection in the drop down will not load as a selection when using safari, what can I do?  I use this for my mobile, on-site auto repair business and not being able to call up repair and diagnostic info and reference for some cars is troublesome for sure. It works fine on the computer and I have installed a remote desktop app as a workaround but it is unreliable because the desktop is not business dedicated and may be off or in use at the time. So is there a known fix for this?
    Let me paint a more descriptive picture, visualize 4 drop down selection menus, first one is for year, next one is for make, 3rd one is model and the last one is for engine size/type. If I wanted to choose a 2012 vehicle it wont work because it is the top selection on the list. This can be forced by selecting any other year and then coming back to 2012. Ok fine, but then let's say I wanted to choose Acura as the make, well it won't take it because again it's the top selection. Again you work around it be selecting any other make and coming back to Acura. Ok now select the model, same trend follows. But now since most Acura vehicles come with dedicated engines and no optional engines I have only 1 selection in that final drop down menu and it will not take my selection and therefore never let me proceed to the info I need.
    This is also true when ordering parts from my wholesaler's website, they use drop downs and I can only get to that last drop down and then I'm stuck. This is blindingly frustrating, what options do I have. I'm not opposed to any avenue at this point.

    Did you ever figure this out? I bought my iPad last week to use in my business as well. I assume you are trying to use alldata? That is where I noticed this same issue. I had problems with identifix working with safari but downloaded a different browser and that works fine. Alldata does not work with either browser. The main difference is that on identifix if there is only one engine selection, it automatically selects the only option and continues to the home page. With alldata you have to make the selection manually even if there is only one option. Honestly if I can't get this to work I am going to return the iPad as it looses a significant amount of usefulness to men

  • I am new to apple hardware, and since upgrading software on my iphone 4S I receive this message.  "this accessory is not supported by this iphone" when using my clock radio docking station. Is there away around this?

    I am new to apple hardware, and since upgrading software on my iphone 4S I receive this message.  "this accessory is not supported by this iphone" when using my clock radio docking station. Is there away around this?

    Hello GuynStPete,
    Thanks for using Apple Support Communities.
    I found the following support article that has some troubleshooting steps for you to follow in order to resolve this issue you're experiencing:
    Resolve issues with iPhone, iPad, and iPod touch accessories
    http://support.apple.com/kb/TS2634
    Take care,
    Alex H.

  • ISE Not Identifying AD Group Attributes when using Multiple ISE Servers

    So we have multiple ISE Servers with differing personas. I was having an issue with our new ISE setup not identifying AD Group Attributes when using them in Authorization rules.
    We have 2- 3395 appliances running Admin and Monitoring/Troubleshooting Personas and 2- 3395 appliances running as Policy server personas. We are running  v1.1.1.268 with the latest two patches.
    I was unable to pull Active Directory Group Attributes in any of my Authorization rules. After Resyncing all the boxes with the Primary Administration box I was able to do this. There is no bug listings for this occurance nor do we have Smartnet to call support for other reasons. I thought this might be useful to someone who is having the same issue and is unable to figure it out with TAC
    -CC

    Absolutely. All units said in-sync after setting their personas.
    Here is our layout:
    ISE-ADM-01  Admin-Primary, Monitoring-Secondary
    ISE-ADM-02  Admin-Secondary, Monitoring-Primary
    ISE-PDP-01  Policy Only
    ISE-PDP-02  Policy Only
    I synced one at a time starting with ADM-02. After completing the other two boxes. Active Directory Attribs were pulled down when using them in the Ext Group within my Authz rules.
    -CC

  • [svn] 1720: Bugs: LCDS-304 - Authentication not working in all cases when using security constraint with NIO endpoints .

    Revision: 1720
    Author: [email protected]
    Date: 2008-05-14 14:50:06 -0700 (Wed, 14 May 2008)
    Log Message:
    Bugs: LCDS-304 - Authentication not working in all cases when using security constraint with NIO endpoints.
    QA: Yes
    Doc: No
    Details:
    Update to the TomcatLoginCommand to work correctly with NIO endpoints.
    Ticket Links:
    http://bugs.adobe.com/jira/browse/LCDS-304
    Modified Paths:
    blazeds/branches/3.0.x/modules/opt/src/tomcat/flex/messaging/security/TomcatLoginCommand. java

    Revision: 1720
    Author: [email protected]
    Date: 2008-05-14 14:50:06 -0700 (Wed, 14 May 2008)
    Log Message:
    Bugs: LCDS-304 - Authentication not working in all cases when using security constraint with NIO endpoints.
    QA: Yes
    Doc: No
    Details:
    Update to the TomcatLoginCommand to work correctly with NIO endpoints.
    Ticket Links:
    http://bugs.adobe.com/jira/browse/LCDS-304
    Modified Paths:
    blazeds/branches/3.0.x/modules/opt/src/tomcat/flex/messaging/security/TomcatLoginCommand. java

  • I can't seem to use the 'Check seats' link on Delta when I use Firefox but Safari works fine. I get the message 'not available at this time' when using Firefox but when I go to Safari it works fine.

    I can't seem to use the 'Check seats' link on the Delta Airlines site when I use Firefox but Safari works fine. I get the message 'not available at this time' when using Firefox but when I go to Safari it works fine. I love Firefox but this sucks!

    That issue can be caused by corrupted cookies.
    Clear the cache and the cookies from sites that cause problems.
    "Clear the Cache":
    *Firefox > Preferences > Advanced > Network > Offline Storage (Cache): "Clear Now"
    "Remove Cookies" from sites causing problems:
    *Firefox > Preferences > Privacy > Cookies: "Show Cookies"
    *http://kb.mozillazine.org/Cookies

  • Cursor does not change to a circle when using eraser

    Cursor does not change to a circle when using the eraser.
    I'm sure it must be a tick box somewhere.
    Its always been ok previously.

    I had this same problem and was searching for answers. I also prefer using a circle instead of crosshairs. I hope you've figured it out by now, but, if you haven't, here is the answer (I am using Elements 9, but, it should work for other versions I think):
    1. Open up Elements Editor, Click on Edit, Click on Preferences, Click on Display & Cursors.
    2. Under Painting Cursors, select Full Size Brush Tip
    3. (optional) - if you want crosshairs within your circle, then also select Show Crosshair in Brush Tip.
    4. Click ok.
    Now use the brush, and it should have a circle to use.
    P.S. Sometimes if you have your Caps Lock key on, that removes the circle as well.

  • Playback not supported by http proxy when using Amazon instant video - what to do?

    Message
    playback not supported by http proxy when using Amazon instant video - what to do?

    Settings > General > Reset > Reset Network Settings

  • USB mouse will not initialise on boot-up when used via Dynadock on Satellite Pro U200

    The USB mouse will not initialize on boot-up when used via Dynadock on Satellite Pro U200. If the mouse is reseated on the Dynadock it works fine. I am using a Kensington Valuoptical USB mouse. I have tried alternative kensington mouse and had the same problem. Can anyone advise how to resolve this issue?

    Hi Jeremy
    Unfortunately I have no solution for your issue but it can also be some technical limitation. I am also interesting to buy such docking station and I would like to know if there is the same problem with external HDD or USB memory sticks.

Maybe you are looking for

  • Job SWWDHEX getting cancelled - OBJECTS_OBJREF_NOT_ASSIGNED

    Hi Guys, Here is the scenario: We modified WF 90000081 in dev box. In production, the workflow has been triggered and is awaiting response from agent. WF 90000081 has been moved to production, the workitems created by the WF in production is still aw

  • Error when building a WebServices Application

    Hi All, Unable to understand this error. Your help is highly appreciated ERROR: TestServices.jws:319:Property Empty of type com.abc.test.utils.AppErrors is not settable and so cannot be unmarshalled from XML. ERROR:      SUGGESTION:In order for an ob

  • Improving performance for java

    I'm new to this so please bare with me ... I have 2 basic questions I just upgraded my server to SunOS 5.10 Generic_139555-08 sun4u sparc SUNW,Sun-Fire-V440 I also upgraded java to java version "1.6.0_14" This is a 4 processor box. Top gives me: last

  • Cursor will not go between divs

    I have dreamweaver open in design view, it has two block level divs. I want to put the cursor between them to add a title to one of the divs, but DW will not let me do this. Arrow key, tabbing, etc just takes me from one div to the other. Using teh m

  • Initiate Std ESS for specified PERNR

    We have a requirement to call standard ESS address maintenance java webdynpro application in our custom abap webdynpro application for a PERNR which is different than the login user. We are able to launch this application using following code. Naviga