Create stored procedure with table from another schema throws PLS-00201

Oracle 10g. I'm new to procedures, so maybe I'm missing something obvious.
Schema owner ABC has table T2001_WRITEOFF. The SYSDBAs granted SIUD to Some_Update_Role, and granted that role to developer user IJK. User IJK then created a private synonym T2001_WRITEOFF for ABC.T2001_WRITEOFF. This worked with normal SQL DML commands. 
When I try to create a simple procedure as follows, it throws PLS-00201 identifier 'T2001_WRITEOFF' must be declared, and points to the 2nd line.
create or replace procedure woof1(
  fooname in T2001_WRITEOFF.territory%TYPE,  <=== error points here
  bardesc IN T2001_WRITEOFF.ind_batch_submit%TYPE) IS
BEGIN
   INSERT into T2001_WRITEOFF
   VALUES ( fooname, bardesc);
END woof1;
What am I doing wrong?
Thanks
JimR

Hi,
The reason I've heard has to do with knowing when a procedure becomes invalid due to privileges being revoked.  Any time a grant to a role is revoked, you would have to check all procedures that depended on that role to know if they were still valid.  Even worse, since roles can be granted to other roles, every time a role is revoked from another role, you would have to check all procedures that depended on anything to see if they were still valid.
Oracle 11 behaves the same as earlier versions in this regard, and I don't expect this to change.
This whole thread applies only to AUTHID DEFINER stored procedures (which is the default).  If you can make the procedure AUTHID CURRENT_USER, then you can run it with privileges granted through roles.  Usually, however, you really want AUTHID DEFINER, and granting the necessary privileges directly to the procedure owner (or to PUBLIC)  isn't too hard.

Similar Messages

  • I have created stored procedure with %rowtype as IN OUT parameter.I want to

    i have created stored procedure with %rowtype as IN OUT parameter.I want to call it in java program

    Hi Avi,
    I have the same problem as the person asking before me, so I'll try and clarify:
    I have a Java client and a PL/SQL database procedure that looks something along the lines of:
    Create of Replace procedure myProc(myRow IN myTable%Rowtype)
    It's very easy to pass a parameter into this procedure from another procedure within the database because creating another myTable%Rowtype is not a problem.
    However, Java doesnt know what "Rowtype" is.
    I was wondering how I would pass a "rowtype" from Java.
    I was thinking along the lines of creating an object in the DB like that:
    Create Type myObj AS myTable%Rowtype (<-- is that even allowed?)
    And then create a procedure in the DB with the header:
    Create of Replace procedure myProc(myRow IN myObj)
    And then, in my Java,just create a STRUCT of my DB object and pass it to the DB:
    myCallableStatement.setObject(1, myStruct);
    Would that work?
    Is there a better way?
    Thanks,
    Dan

  • How to change stored procedure with Table Valued Parameter

    I am not sure how to change the normal stored procedure with Table Value Parameter.Do I have to create a separate Table or do I have to create a datatype. Can you please help me with this
    ALTER PROCEDURE [dbo].[uspInsertorUpdateINF]
    @dp_id char(32),
    @dv_id char(32),
    @em_number char(12),
    @email varchar(50),
    @emergency_relation char(32),
    @option1 char(16),
    @status char(20),
    @em_id char(35),
    @em_title varchar(64),
    @date_hired datetime
    AS
    BEGIN
    SET NOCOUNT ON;
    MERGE [dbo].[em] AS [Targ]
    USING (VALUES (@dp_id, @dv_id , @em_number, @email, @emergency_relation, @option1, @status, @em_id, @em_title, @date_hired))
    AS [Sourc] (dp_id, dv_id, em_number, email, emergency_relation, option1, status, em_id, em_title, date_hired)
    ON [Targ].em_id = [Sourc].em_id
    WHEN MATCHED THEN
    UPDATE
    SET dp_id = [Sourc].dp_id,
    dv_id = [Sourc].dv_id,
    em_number = [Sourc].em_number,
    email = [Sourc].email,
    emergency_relation = [Sourc].emergency_relation,
    option1 = [Sourc].option1,
    status = [Sourc].status,
    em_title = [Sourc].em_title,
    date_hired = [Sourc].date_hired
    WHEN NOT MATCHED BY TARGET THEN
    INSERT (dp_id, dv_id, em_number, email, emergency_relation, option1, status, em_id, em_title,date_hired)
    VALUES ([Sourc].dp_id, [Sourc].dv_id, [Sourc].em_number, [Sourc].email, [Sourc].emergency_relation, [Sourc].option1, [Sourc].status, [Sourc].em_id, [Sourc].em_title, [Sourc].date_hired);
    END;

    It's not clear how you would change the procedure. But assuming that you want to replace the existing scalar parameters with tabular input, this is how you would do it. You first create a table type:
    CREATE TYPE  Insertor_type AS TABLE
        (dp_id                char(32),
         dv_id                char(32),
        em_number            char(12),
        email                varchar(50),
        emergency_relation   char(32),
        option1              char(16),
        status               char(20),
        em_id                char(35),
        em_title             varchar(64),
        date_hired           datetime)
    Then you change the procedure header:
    ALTER PROCEDURE [dbo].[uspInsertorUpdateINF] @tvp Insertor_type READONLY AS
    And finally you change the USING clause:
       USING (SELECT dp_id, dv_id , em_number, email, emergency_relation, option1, status, em_id, em_title, date_hired
              FROM   @tvp) AS [Sourc] ON [Targ].em_id = [Sourc].em_id
    The rest is fine as it is.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Query with Tables from another Database

    Hi.
    I have a problem with a Query that executes a stored procedure that inserts data in a Table from another DataBase. The problem is when I try to execute a Query with the data related of that table using the user parameters of SBO ('[%0]'....'[%3]'). I use the following parameters for reference to the Table:
    "....FROM [-BDName-].[dbo].[-TableName-] T1..... "
    Any suggestions? Thanks a lot....
    (Suggestions in English or Spanish)

    None

  • Calling Stored Procedure with table type as In parameter from Java

    Hi Everyone,
    Can anyone help me with the sample code to call a stored procedure having input parameter of Table type (consisting of multiple fields) from Java. This job is currently being done by a BPEL process.
    We want to implement the same using Java.
    Any sample code will be really helpful.
    Thanks & Regards,
    Vikas

    To start using a blob you have to insert it into the database and then get it back. Sounds weird but that is how it is. Here is a very simple program to do this:
    #include<occi.h>
    #include <iostream>
    using namespace oracle::occi;
    using namespace std;
    int main()
      try
        Environment *env = Environment::createEnvironment(Environment::OBJECT);
        Connection *conn = env->createConnection("hr","hr","");
        string stmt1 = "insert into blob_tab values (:1) ";
        string stmt2 = "select col1 from blob_tab";
        Blob blob(conn);
        blob.setEmpty(conn);
        Statement *stmtObj = conn->createStatement(stmt1);
        stmtObj->setBlob(1,blob);
        stmtObj->executeUpdate();
        conn->commit();
        Blob blob1(conn);
        Statement *stmtObj2 = conn->createStatement(stmt2);
        ResultSet *rs = stmtObj2->executeQuery();
        while(rs->next())
         blob1 = rs->getBlob(1);
        string stmt3 = "begin my_proc(:1) ;end;";
        Statement *stmtObj3 =  conn->createStatement(stmt3);
        stmtObj3->setBlob(1,blob1);
        stmtObj3->executeUpdate();
      catch (SQLException e)
        cout << e.getMessage();
      /* The tables and procedure are primitive but ok for demo
        create table blob_tab(col1 blob);
        create or replace procedure my_proc(arg in blob)
        as
        begin
         -- just a putline here. you can do other more meaningful operations with the blob here
          dbms_output.put_line('hello');
       end;
    }Hope this helps.
    Thanks,
    Sumit

  • How to call a procedure with refcursor  from another  plsql unit

    example I created a pkg with the a procedure that returns a REFCURSOR.
    Now I need to call this procedure from another pkg and use the refcursor values in other pkg.
    Help please.......
    PROCEDURE CustomerSite_Get (p_Registry IN VARCHAR2,
    p_CustomerNumber IN VARCHAR2, p_Cursor IN OUT t_cursor);
    PROCEDURE CustomerSite_Get (p_Registry IN VARCHAR2,
    p_CustomerNumber IN VARCHAR2, p_Cursor IN OUT t_cursor)
    IS
    -- 0903: Include BillToName
    BEGIN
    OPEN p_Cursor FOR
         SELECT S.LOCATION CustomerSite, S.SITE_USE_ID CustomerSiteID, C.CUSTOMER_NAME BillToName
         FROM RA_CUSTOMERS C,
    RA_ADDRESSES A,
    RA_SITE_USES S,
    UWA_REGISTRY R,
    UWA_REGISTRY_BILL_TO B
         WHERE C.CUSTOMER_ID = A.CUSTOMER_ID
         AND A.ADDRESS_ID = S.ADDRESS_ID
         AND S.SITE_USE_ID = B.SITE_USE_ID
         AND R.REGISTRY_ID = B.REGISTRY_ID
         AND B.TRIP_BILLING != 'N'
         AND R.DELETE_FLAG != 'Y'
              AND R.Registry = p_Registry
              AND R.CUSTOMER_NUM = p_CustomerNumber
         ORDER BY S.LOCATION;
    END CustomerSite_Get;
    thanks,
    Anitha.
    Edited by: user521218 on May 6, 2009 1:24 PM

    Hi Anitha,
    try this,
    -- PKG_A
    Procedure CustomerSite_Get( p_Registry       IN Varchar2
                              , p_CustomerNumber IN Varchar2
                              , p_Cursor         IN OUT t_cursor) Is
    Begin
       PKG_B.CustomerSite_Get( p_Registry     
                             , p_CustomerNumber
                             , p_Cursor );
    End;
    -- PKG_B
    Procedure CustomerSite_Get(p_Registry       IN Varchar2
                              ,p_CustomerNumber IN Varchar2
                              ,p_Cursor         IN OUT t_cursor) Is
    Begin
       Open p_Cursor For
          SELECT S.LOCATION      CustomerSite
                ,S.SITE_USE_ID   CustomerSiteID
                ,C.CUSTOMER_NAME BillToName
            FROM RA_CUSTOMERS         C
                ,RA_ADDRESSES         A
                ,RA_SITE_USES         S
                ,UWA_REGISTRY         R
                ,UWA_REGISTRY_BILL_TO B
           WHERE C.CUSTOMER_ID = A.CUSTOMER_ID
             AND A.ADDRESS_ID = S.ADDRESS_ID
             AND S.SITE_USE_ID = B.SITE_USE_ID
             AND R.REGISTRY_ID = B.REGISTRY_ID
             AND B.TRIP_BILLING != 'N'
             AND R.DELETE_FLAG != 'Y'
             AND R.Registry = p_Registry
             AND R.CUSTOMER_NUM = p_CustomerNumber
           Order BY S.LOCATION;
    End CustomerSite_Get;regards,
    Christian Balz

  • Analytic View with tables from different schema

    Hi,
    I'm curious if I make something wrong or if this is not possible:
    I want to use two tables each in a different schema. I can drop them into the DataFoundation, can connect them, assign them some measure. But activation fails due to insufficient privileges. When I use the tables from the same schema activation works well. With the insufficient privileges I would guess HANA cannot create a View (failed with the statement CREATE COLUMN_VIEW "_SYS_BIC"."USER/ANALYTIC_VIEW_NAME"....).
    Since I tried the same assignment with the System-User and failed I wonder what kind of permissions are required. Or is this generally not allowed (resp. prohibited)?
    If not allowed, could somebody give me a hint, why its not possible?
    If it is possible, what kind of rights are required to get it working?
    roland

    Hm', I have allowed SYS_REPO the rights to the table and was able to activate the view. But now I have the problem, that the DataPreview is not working (again insufficient privileges). What user has to have additional permissions for the JDBC-query?
    Do I have to take care more on the privileges for other things?

  • Calling DB2 Stored procedure(with parameters) from powershell

    Hi 
    I am trying to call a DB2 stored procedure that has parameters from Powershell scrip and I am not able to can some one help me here?
    $ServerName = 'XXXX'
    $dbalias='XXXXX'
     $conn_string = "Provider=IBMDADB2;DBALIAS=$dbalias;Uid=;Pwd=;"
     $conn = new-Object system.data.Oledb.OleDbconnection
     $conn.ConnectionString = $conn_string
     $conn.open()
     $query="CALL DBID_CONTROL.GET_TABLE_MAINT_CTL(?,?,?,'MSAS','DATABASE_CONNECTIONS_CUBE','CUBE_PARTITION');"
     $cmd = new-Object system.data.Oledb.OleDbcommand($query,$conn)
      $ds=New-Object system.Data.DataSet
     $da=New-Object System.Data.OleDb.OleDbDataAdapter($cmd)
      $da.Fill($ds) [int]$cur_utc_date_key = $ds.Tables[0].Rows[0][0]
     $cur_utc_date          = $ds.Tables[0].Rows[0][1]
     ###list current date key & current date values
     write-output "current date key value is $cur_utc_date_key"
     write-output "current date value is $cur_utc_date"
     write-output " "
    Thanks

    Hi 
    This is the error message i get when i run the script
    Exception calling "Fill" with "1" argument(s): " CLI0100E  Wrong number of parameters. SQLSTATE=07001"
    At line:45 char:10
    +  $da.Fill <<<< ($ds)
        + CategoryInfo          : NotSpecified: (:) [], ParentContainsErrorRecordException
        + FullyQualifiedErrorId : DotNetMethodException

  • Calling Stored Procedure with parameters from a C program

    Hello, I need to call a PL/SQL stored procedure from a C program.
    Something like this sample program provided by Oracle -
    main()
    int i;
    EXEC SQL BEGIN DECLARE SECTION;
    */* Define type for null-terminated strings. */*
    EXEC SQL TYPE asciz IS STRING(20);
    asciz  username[20];
    asciz  password[20];
    int    dept_no;    / which department to query */*
    char   emp_name[10][21];
    char   job[10][21];
    EXEC SQL VAR emp_name is STRING (21);
    EXEC SQL VAR job is STRING (21);
    float  salary[10];
    int    done_flag;
    int    array_size;
    int    num_ret;    / number of rows returned */*
    int    SQLCODE;
    EXEC SQL END DECLARE SECTION;
    */* Connect to Oracle. */*
    strcpy(username, "SCOTT");
    strcpy(password, "TIGER");
    EXEC SQL WHENEVER SQLERROR DO sqlerror();
    EXEC SQL CONNECT :username IDENTIFIED BY :password;
    printf("Enter department number: ");
    scanf("%d", &dept_no);
    fflush(stdin);
    */* Set the array size. */*
    array_size = 10;
    done_flag = 0;
    num_ret = 0;
    */* Array fetch loop - ends when NOT FOUND becomes true. */*
    EXEC SQL EXECUTE
    BEGIN personnel.get_employees
    *(:dept_no, :array_size, :num_ret, :done_flag,*
    *:emp_name, :job, :salary);*
    END;
    END-EXEC;
    The question is - how is the Stored procedure get_employees declared ? Or more specifically, how is the salary parameter declared in get_employees ? Any help is highly appreciated.

    Hope following will help
    NOTE: Not tested
    Calling a stored procedure
    This program connects to ORACLE using the SCOTT/TIGER
    account. The program declares several host arrays, then
    calls a PL/SQL stored procedure (GET_EMPLOYEES in the
    CALLDEMO package) that fills the table OUT parameters. The
    PL/SQL procedure returns up to ASIZE values.
    It keeps calling GET_EMPLOYEES, getting ASIZE arrays
    each time, and printing the values, until all rows have been
    retrieved. GET_EMPLOYEES sets the done_flag to indicate "no
    more data."
    #include <stdio.h>
    #include <string.h>
    EXEC SQL INCLUDE sqlca.h;
    typedef char asciz[20];
    typedef char vc2_arr[11];
    EXEC SQL BEGIN DECLARE SECTION;
    /* User-defined type for null-terminated strings */
    EXEC SQL TYPE asciz IS STRING(20) REFERENCE;
    /* User-defined type for a VARCHAR array element. */
    EXEC SQL TYPE vc2_arr IS VARCHAR2(11) REFERENCE;
    asciz username;
    asciz password;
    int dept_no; /* which department to query? */
    vc2_arr emp_name[10]; /* array of returned names */
    vc2_arr job[10];
    float salary[10];
    int done_flag;
    int array_size;
    int num_ret; /* number of rows returned */
    EXEC SQL END DECLARE SECTION;
    long SQLCODE;
    void print_rows(); /* produces program output */
    void sql_error(); /* handles unrecoverable errors */
    main()
    int i;
    char temp_buf[32];
    /* Connect to ORACLE. */
    EXEC SQL WHENEVER SQLERROR DO sql_error();
    strcpy(username, "scott");
    strcpy(password, "tiger");
    EXEC SQL CONNECT :username IDENTIFIED BY :password;
    printf("\nConnected to ORACLE as user: %s\n\n", username);
    printf("Enter department number: ");
    gets(temp_buf);
    dept_no = atoi(temp_buf);/* Print column headers. */
    printf("\n\n");
    printf("%-10.10s%-10.10s%s\n", "Employee", "Job", "Salary");
    printf("%-10.10s%-10.10s%s\n", "--------", "---", "------");
    /* Set the array size. */
    array_size = 10;
    done_flag = 0;
    num_ret = 0;
    /* Array fetch loop.
    * The loop continues until the OUT parameter done_flag is set.
    * Pass in the department number, and the array size--
    * get names, jobs, and salaries back.
    for (;;)
    EXEC SQL EXECUTE
    BEGIN calldemo.get_employees
    (:dept_no, :array_size, :num_ret, :done_flag,
    :emp_name, :job, :salary);
    END;
    END-EXEC;
    print_rows(num_ret);
    if (done_flag)
    break;
    /* Disconnect from the database. */
    EXEC SQL COMMIT WORK RELEASE;
    exit(0);
    void
    print_rows(n)
    int n;
    int i;
    if (n == 0)
    printf("No rows retrieved.\n");
    return;
    for (i = 0; i < n; i++)
    printf("%10.10s%10.10s%6.2f\n",
    emp_name, job[i], salary[i]);
    /* Handle errors. Exit on any error. */
    void
    sql_error()
    char msg[512];
    int buf_len, msg_len;
    EXEC SQL WHENEVER SQLERROR CONTINUE;
    buf_len = sizeof(msg);
    sqlglm(msg, &buf_len, &msg_len);
    printf("\nORACLE error detected:");
    printf("\n%.*s \n", msg_len, msg);
    EXEC SQL ROLLBACK WORK RELEASE;
    exit(1);
    Remember, the datatype of each actual parameter must be convertible to the datatype of its corresponding formal parameter. Also, before a stored procedure is exited, all OUT formal parameters must be assigned values. Otherwise, the values of corresponding actual parameters are indeterminate.
    SQLCHECK=SEMANTICS is required when using an anonymous PL/SQL block.

  • Stored Procedure with Table as data type , DBAdapter  configuration

    i have a stored procedure .
    XXyyyy_QP_PKG.XXyyyy_QP_PRICE_BOOK_PUB(l_xxyyy_prc_dtl_tbl,l_xxyyy_prc_brk_tbl,l_status,'New',5840,'New');
    where l_xxyyy_prc_dtl_tbl ,l_xxyyy_prc_brk_tbl are the tables as output parameter.
    Steps Performed for above scenario :
    i have created database adapter using stored procedure configuration, that created a Wrapper procedure during the configuration in Oracle DB.
    and thus i can find bpel_*******Create.sql and bpel_*******DROP.sql files got created .
    When i actually gone on package which crted by dbadapter , that are errored out , then i have manually droped and ran the create script .
    create script will results in some compilation erors of procedure .
    How can i fix this problem ? If i have same scenario which is for ORacle API using Oracle Apps adapter that creates correct wrapper procedure .
    how all these can be achieved .
    Not sure whther this DBAdapter really works in these scenarios or not .
    Edited by: anantwag on Dec 13, 2012 3:29 AM

    These are the errors iam getting .
    But the Existing Stored Procedure which needs to be exposed , works fine on sqlplus.
    Errors: check compiler log
    8/12 PLS-00302: component 'DETAIL' must be declared
    8/3 PL/SQL: Statement ignored
    9/12 PLS-00302: component 'LIST_NAME' must be declared
    9/3 PL/SQL: Statement ignored
    10/12 PLS-00302: component 'BREAK_TYPE' must be declared
    10/3 PL/SQL: Statement ignored
    11/12 PLS-00302: component 'DESCRIPTION' must be declared
    11/3 PL/SQL: Statement ignored
    12/12 PLS-00302: component 'ADJUSTMENT_METHOD' must be declared
    12/3 PL/SQL: Statement ignored
    13/12 PLS-00302: component 'ADJUSTMENT_VALUE' must be declared
    13/3 PL/SQL: Statement ignored
    20/33 PLS-00302: component 'DETAIL' must be declared
    20/3 PL/SQL: Statement ignored
    21/36 PLS-00302: component 'LIST_NAME' must be declared
    21/3 PL/SQL: Statement ignored
    22/37 PLS-00302: component 'BREAK_TYPE' must be declared
    22/3 PL/SQL: Statement ignored
    23/38 PLS-00302: component 'DESCRIPTION' must be declared
    23/3 PL/SQL: Statement ignored
    Commit
    Edited by: anantwag on Dec 13, 2012 10:39 AM

  • Problem Calling MaxDB stored procedure with output from MII Query template

    Hi,
    I am using Max DB Database studio to write stored procedure, I am calling stored procedure from MII Query using CALL statement.
    Can anyone guide me how to pass output values of stored procedure.
    Examlpe::
    call ProcName('[Param.1]','[Param.2]','[Param.3]','[Param.4]','[Param.5]', :isSuccess, :Trace)
    In the above line of code I am not able to get the output values of stored procedure that is isSuccess and Trace values in Query template when executed. But same thing I get when executed in Database studio.
    How do I call with outputs for any stored procedure in MII.
    Any help would be appriciated.
    Thanks,
    Padma

    My call statement is like this
    call RESULTDATA_INSERT('[Param.1]','[Param.2]','[Param.3]', :isSuccess, :Trace)
    I am able to insert record in DB, But I am not getting output values in Query template.I have done this in Fixed Query, when I execute it throws me "Fatal error as Loaded content empty".
    I tried giving select below call but it dont work.
    Regards,
    Rao

  • Report on a table from another schema

    hi,
    i have a table PROJECTS in schema CSALE when i create a report in APPEXP application (persing via user TESTER2) it gives me the error table does not found while TESTER2 has full writes on PROJECTS table.
    select project_id ID, Project_name DESC from SCALE.PROJECTS;
    when i run this query from SQL PLUS it works fine.
    I have used synonym it giving me the error
    ORA-04045: errors during recompilation/revalidation of TESTER2.PROJECTS
    ORA-00980: synonym translation is no longer valid
    Please help me how can i create a report on the table of other schema.
    Thanks

    In your schema CSALE (SCALE you stated as well)
    GRANT SELECT ON projects TO tester2In your schema TESTER2
    CREATE OR REPLACE SYNONYM projects FOR csale.projectsnow
    SELECT project_id ID, project_name description
      FROM projects;should work for you.
    Please note:
    You were using a reserved word in your query (DESC) for column alias for Project_name.
    Denes Kubicek

  • Entity Framework - Execute Stored Procedures With Table Valued Patameter

    How to pass a table valued parameter to a stored procedure in Entity Framework using ExecuteSqlCommand or SqlQuery method?
    Following is my code - 
    DataTable dataTable=new DataTable();
    dataTable.Columns.Add("col1", typeof(int));
    dataTable.Columns.Add("col2", typeof(bool));
    dbContext.Database.ExecuteSqlCommand("exec stored_proc @tvp",
                            new SqlParameter() { SqlDbType = SqlDbType.Structured, ParameterName = "@tvp", Value = dataTable }
    This throws an exception saying 'The table type parameter '@tvp' must have a valid type name.'

    You must set the TypeName property of the SqlParameter to the name of your table type that you have defined in the database:
    SqlParameter param = new SqlParameter();
    param.SqlDbType = SqlDbType.Structured;
    param.ParameterName = "@tvp";
    param.TypeName = "dbo.YourTableType";
    param.Value = dataTable;
    dbContext.Database.ExecuteSqlCommand("exec stored_proc @tvp", param);
    Of course you must define the table type in the database first:
    CREATE TYPE dbo.YourTableType AS TABLE
    ( col1 int, col1 bit )
    Please remember to the following page on MSDN for more information:
    https://msdn.microsoft.com/en-us/library/bb675163(v=vs.110).aspx
    Hope that helps.
    Please also remember to close your threads by marking helpful posts as answer and then start a new thread if you have a new question. Please don't ask several questions in the same thread.

  • Calling a procedure (with refcursor) from another procedure

    I have a procedure that returns refcursor (it's used by a Java application).
    I am able to run the proc via SQLPlus like below:
    var a refcursor;
    exec MY_PKG.get_content_prc(:a);
    print a;
    I would like to use/call this proc from another procedure and I am not able to, since arg is refcursor.
    create or replace procedure p
    is
    v refcursor;
    begin
    MY_PKG.get_content_prc(:v);
    end;
    Error I get is:
    SQL> show err
    Errors for PROCEDURE P2:
    LINE/COL ERROR
    4/3 PL/SQL: Item ignored
    4/7 PLS-00201: identifier 'CURSOR' must be declared
    6/5 PL/SQL: Statement ignored
    6/57 PLS-00320: the declaration of the type of this expression is
    incomplete or malformed
    Hope someone can direct me.
    Regards

    Because you are not using the right syntax.
    You need to do something like this
    LOOP
       /* Fetch from cursor variable. */
       FETCH emp_cv INTO emp_rec;
       EXIT WHEN emp_cv%NOTFOUND; -- exit when last row is fetched
       -- process data record
    END LOOP;This is from the PL/SQL User's Guide and Reference.
    I would recommend reading this fine manual, it is faster than guessing.

  • Call Oracle Stored Procedure with Parameters from Windows Batch File

    Hi,
    I have an oracle procedure that requires two parameters to execute, start date and end date as such:
    CREATE OR REPLACE PROCEDURE insert_orders(
    pSTART_DT IN varchar2
    , pEND_DT IN varchar2
    I want to create a windows batch file to execute the procedure but want to be able to specify the parameters (ie start and end dates) in the batch file as opposed to changing the sql file that the batch file uses to execute the procedure but I don't know what the syntax is. I tried the following but it still doesn't work.
    Sql File: call_insert_orders.sql
    execute insert_orders('&1','&2');
    exit
    Batch File:
    sqlplus username/password @call_insert_orders.sql %01-jan-2010% %01-jan-2011%
    When I execute the batch file, my DOS window still prompts me to enter value 1 so I think it recognizes that there is a variable being used but is not able to fill in the actual value I specify. I'm not an experienced DOS/Windows Batch File person so I'm guessing it's my syntax that's screwed up. There is not a lot of documentation on this subject matter hence my post on this forum. Any helps would be appreciated.
    Thanks

    Hello,
    Just try the same DOS command without all the % sign.
    In MS-DOS, the % at the beginning and at the end of a string are for variables. Which means your batch is looking for a variable called 01-jan-2010 and a variable called 01-jan-2011, but those are the values you want to pass, not the name of variables.
    As they are not defined, nothing is passed to the sqlplus script, and that is why you are prompted for values.
    Hope it will help.
    Regards,
    Sylvie

Maybe you are looking for

  • Java Desktop not rendering windows in proper order

    We have an old app written in C, using X-windows/Motif.  It runs on Solaris 10. In CDE -- when our users run the app, and an alert message box pops up -- it renders correctly ON TOP of the main app window.   User can click "OK" to remove the alert bo

  • Issue in Sub query

    create table temp1 (empno number , eName varchar2(20)); create table temp2 (empno1 number ,age number); Below query running fine even though there is no column "empno" in temp2 table and it is not co related query. select * from temp1 where empno in

  • Raw Images still Icons only

    After the latest round of updates from Adobe for Windows Bridge (Win7 62 and 34) I have the problem of all raw images showing up as icons in Bridge. The images will open in the converter fortunately but it would be nice to see what the image is befor

  • Help getting rid of pixels on ipod

    Ok, I have music videos on my Ipod and when I watch them , there are lots of pixels. I use Videora and if there are settings to reduce the amount of pixels, can someone help me?

  • Perfor using and Changing Concept

    Hello Guys,            Can anybody describe in detail about PERFORM USING and CHANGING concepts. because i am using multiple times the perform statememnt for a same fuctionality so i want to use the single PERFORM statement for multiple number of tim