Problem with stored procedure

I use 10g, I have a 'PACK_SP' package with stored procedures, one of them is the following:
PROCEDURE USP_ROWLARGESIZE(tablename VARCHAR2, cur_Types OUT CLOB,  v_namePrimaryKey OUT CLOB, cur_Result OUT CLOB) IS
v_sql_str VARCHAR2(1000);
v_ctx VARCHAR2(100);
v_rowlength pls_integer;
qryCtx DBMS_XMLGEN.ctxHandle;
BEGIN

-- Begin error stmt

SELECT SYS.COL$.NAME INTO v_namePrimaryKey 
FROM SYS.COL$ INNER JOIN SYS.OBJ$ ON SYS.COL$.OBJ# = SYS.OBJ$.OBJ# 
              INNER JOIN SYS.CCOL$ ON SYS.COL$.OBJ# = SYS.CCOL$.OBJ# 
              INNER JOIN SYS.CDEF$ ON SYS.CCOL$.CON# = SYS.CDEF$.CON# 
WHERE SYS.OBJ$.NAME = tablename AND SYS.CDEF$.TYPE# = 2 AND SYS.COL$.COL# = SYS.CCOL$.COL#;

-- End error stmt 

(...)

END USP_ROWLARGESIZE;
As you can see, I have marked the statement with the error according to the OEM error message. The error text is: "Error Text = PL/SQL: ORA-00942: table or view does not exist. My goal is to store in the output parameter 'v_namePrimaryKey' the primary key column of a tablename. This query only works in more SQL query editor. Could someone help me?

Thank you very much in advance!

Published by: user9112176 on February 10, 2010 18:30

Published by: user9112176 on February 10, 2010 18:31

Published by: user9112176 on February 10, 2010 18:32

Published by: user9112176 on February 10, 2010 18:33

Published by: user9112176 on February 10, 2010 19:22

System objects are accessible in SQL because they are visible through roles (DBA or SELECT_CATALOG_ROLE for example).

However, the roles are disabled in PLSQL. You must have explicit privileges.
That said, I would strongly advice you against writing code that references the SYS objects directly. You should use the USER_ or ALL_ % (or, if you really really must) the DBA_ % views.

Hemant K Collette
http://hemantoracledba.blogspot.com

Tags: Database

Similar Questions

  • Problem with stored procedure and validation

    I have the following stored procedure:

    create or replace PROCEDURE SOME_PROC)

    /*

    Some settings

    */

    ) AS

    NUMBER of errors

    BEGIN

    errors: = FN_CHECK_BUSINESS_RULE_1 (/ * some args * /);

    if(Errors > 0) then

    raise_application_error (ERR_CONSTANTS. SOME_ERROR_NUMBER, ERR_CONSTANTS. SOME_ERROR_MESSAGE);

    end if;

    INSERT INTO une_table (/ * columns * /) VALUES (/ * values * /);

    END SOME_PROC;

    Because the business rule 1 is placed inside the stored procedure I can't check it out without calling the stored procedure.

    I need to call the stored procedure 10 times with a different set of parameters and validation of the changes only after all calls to the stored procedure

    are successful. I want to show the user all the errors that occurred during the stored procedure calls. If for a first example of stored procedure call

    succeeds and a second failure no data has to be stored in a database.

    How to prevent the stored procedure for insert lines until I call the method commit of ApplicationModule?

    Thanks in advance.

    No, other users only see the lines until you commit. The search term is the transaction isolation level. Tom Kite write a paper on this here ask Tom: on transaction isolation levels. This article gives some samples, according to theory, and you should read it.

    Timo

  • Problems with the procedure at the level of the stcok update

    Hi, I am new to Oracle and I have problems with this procedure.
    I had two tables, orders and inventories, and I want to update inventory quantities, when I received the order. For some reason, NULL keeps popping out. Someone help me pls with this!
    The tables are

    create table orders
    (order_no number (4) orders_nn_11 the NOT NULL constraint,)
    item_no number 4 orders_nn_3 of the NOT NULL constraint,
    order_qta number constraint orders_nn_4 NOT NULL,
    ORDER_DATE date NOT NULL constraint orders_nn_2,
    (date of receipt);
    and
    create the table stock
    item_no (4).
    Number of CQI,
    constraint stock_pk foreign key (item_no) references products (item_no);

    the procedure is here, but as I said I am new to this, so I really don't know.


    create or replace
    procedure recues1 (aorder_no in number, aitem_no in numbers, date received)
    is
    quantity number;
    number of quantity2;
    cursor a1 is select qta in stock where item_no = aitem_no;
    cursor a2 is order_qta selection of orders where order_no = aorder_no and item_no = aitem_no;
    Start
    Open a1;
    extract the a1 in quantity2;
    Open a2;
    Fetch a2 in quantity;
    stock update
    Define qta = quantity2 + quantity
    where item_no = aitem_no;
    Update orders
    received game = sysdate
    where order_no = aorder_no;
    near a1;
    Close a2;
    end;
    /

    Thanks in advance

    Hello
    Perhaps because ther eis no COMMIT.
    Or have I missed?

    Something like that

    .....
    
    close a1;
    close a2;
    commit;
    end;
    /
    

    Kind regards
    Bobin

  • Error PLS-00306 with stored procedure

    I am trying to create a simple package and store the procedure to remove the date of treatment for Crystal Reports can read all data. I used an example on the web site for Crystal report as reference in SAP: link: [http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/1084c536-711e-2b10-e48a-924a60745253;jsessionid= (J2EE3417200) ID0966300750DB00193623365600119940End]

    I ran the following and receive PLS-00306: wrong number or type of argument on the stored procedure. I am also pulling data with a databaselink to another data base given that our third-party vendor will not connect directly to the main database.

    I am new to PL/SQL, so I don't know what else to solve problems. Thank you for taking the time to review this.

    -1. Create a temporary table
    CREATE TEMPORARY TABLE global test_temp
    (processdate DATE NOT NULL);

    -2.Create package w / require REF CURSOR for Crystal reports
    CREATE or REPLACE PACKAGE test_package
    IN the TYPE processdate_TYPE IS REF CURSOR
    RETURN test_temp % ROWTYPE;
    END test_package;
    /

    -3. Stored procedure
    CREATE OR REPLACE PROCEDURE test_Procedure
    (processdate_cursor IN OUT test_Package.processdate_TYPE,
    processdate_parameter IN test_temp.processdate%TYPE)
    AS
    processdate DATE;
    BEGIN
    OPEN FOR Processdate_cursor
    SELECT processdate
    OF processlog@WEATEST
    WHERE processname = "F_ExecuteScheduleProcess" and processtype = ';
    END test_Procedure;
    /

    You say that you do not understand where there is a wrong number or type?

    This error occurs because there is an incorrect number of parameters passed. Your procedure
    Test_SP expects 3 parameters as defined by you as follows
    (p_ID in number,
    p_firstname OUT varchar2,
    p_lastname OUT varchar2)

    But when you run, you're not not p_id, has not managed to p_firstname, has failed to p_lastname. So there are number of parameters and that's what suggests the error.

    To run your test_sp
    Declare
    sFirstName Test_Table.FirstName%Type;
    sLastName Test_Table.Lastname%Type;
    Nest Test_Table.ID%Type: = 1;
    Begin
    Test_SP(1,sFirstName,sLastName);
    End;

    I hope this helps.

  • Called Java overloaded with stored procedures

    I have two stored procedures with the same name and the same number of parameters. They are overworked because the two procedures differ in the data type of their parameters. In addition, there are 2 2 parameters and the other has 3 in and 1 OUT parameter.

    But Java has problem describing as Java is unable to distinguish that they are two different procedures. How Java should treat calling them? I don't want to change their name.

    Thank you

    user5406804 wrote:
    Is not in Java, no way to achieve
    nom_de_variable-online value

    What you are referring is named notation, a way to specify an argument name with its value instead of associating the argument which the variable position value in the call. Given that the appeal should be processed through SQL and just be text to Java try to use named notation in the appeal of Java like you did in Oracle directly and see if it works. If it does not try to use the wrapper procedure I described.

  • Insert table with stored procedure

    Hello

    is it possible to use bind insert table in odp.net that calls a stored procedure, or who loses the point of contact of the table?

    I need to do at once two insertions in a parent table and the child table (get the primary key generated by a sequence in the first table.). Don't know if this can be done without storing seq.next_val somehow?

    Edit: I will extend the question and ask if the table bind sql text can be a block anonymous plsql

    Edited by: KarlTrumstedt 16-jun-2010 02:49

    You can do both. You can table insert a stored procedure and an anonymous block.

    Here's how (these are based on the ArrayBind example provided with the installation of ODP.net/ODT.

    Installation program:

    create table zdept (deptno number, deptname varchar2(50), loc varchar2(50));
    
    CREATE OR REPLACE PROCEDURE ZZZ (p_deptno in number, p_deptname in varchar2, p_loc in varchar2) AS
    begin
        insert into zdept values(p_deptno , p_deptname || ' ' || p_deptname, p_loc );
    end zzz;
    
     /**
     drop table zdept ;
     drop procedure ZZZ ;
     **/
    

    table and link it to the stored procedure call:

       static void Main(string[] args)
        {
          // Connect
          string connectStr = "User Id=;Password=;Data Source=";
    
          // Setup the Tables for sample
          Setup(connectStr);
    
          // Initialize array of data
          int[]    myArrayDeptNo   = new int[3]{1, 2, 3};
          String[] myArrayDeptName = {"Dev", "QA", "Facility"};
          String[] myArrayDeptLoc  = {"New York", "Maryland", "Texas"};
    
          OracleConnection connection = new OracleConnection(connectStr);
          OracleCommand    command    = new OracleCommand (
            "zzz", connection);
          command.CommandType = CommandType.StoredProcedure;
    
          // Set the Array Size to 3. This applied to all the parameter in
          // associated with this command
          command.ArrayBindCount = 3;
          command.BindByName = true;
          // deptno parameter
          OracleParameter deptNoParam = new OracleParameter("p_deptno",OracleDbType.Int32);
          deptNoParam.Direction       = ParameterDirection.Input;
          deptNoParam.Value           = myArrayDeptNo;
          command.Parameters.Add(deptNoParam);
    
          // deptname parameter
          OracleParameter deptNameParam = new OracleParameter("p_deptname", OracleDbType.Varchar2);
          deptNameParam.Direction       = ParameterDirection.Input;
          deptNameParam.Value           = myArrayDeptName;
          command.Parameters.Add(deptNameParam);
    
          // loc parameter
          OracleParameter deptLocParam = new OracleParameter("p_loc", OracleDbType.Varchar2);
          deptLocParam.Direction       = ParameterDirection.Input;
          deptLocParam.Value           = myArrayDeptLoc;
          command.Parameters.Add(deptLocParam);
    
          try
          {
            connection.Open();
            command.ExecuteNonQuery ();
            Console.WriteLine("{0} Rows Inserted", command.ArrayBindCount);
          }
          catch (Exception e)
          {
            Console.WriteLine("Execution Failed:" + e.Message);
          }
          finally
          {
            // connection, command used server side resource, dispose them
            // asap to conserve resource
            connection.Close();
            command.Dispose();
            connection.Dispose();
          }
        }
    

    "anonymous plsql block.
    Well Yes

        static void Main(string[] args)
        {
          // Connect
          string connectStr = "User Id=;Password=;Data Source=";
    
          // Setup the Tables for sample
          Setup(connectStr);
    
          // Initialize array of data
          int[]    myArrayDeptNo   = new int[3]{1, 2, 3};
          String[] myArrayDeptName = {"Dev", "QA", "Facility"};
          String[] myArrayDeptLoc  = {"New York", "Maryland", "Texas"};
    
          OracleConnection connection = new OracleConnection(connectStr);
          OracleCommand    command    = new OracleCommand (
            "declare dnumber number; dname varchar2(50) ; begin dnumber := :deptno;dname := :deptname;insert into zdept values (:deptno, :deptname, :loc); update zdept set deptname=dname || :loc where deptno = :deptno; end;", connection);
    
          // Set the Array Size to 3. This applied to all the parameter in
          // associated with this command
          command.ArrayBindCount = 3;
          command.BindByName = true;
          // deptno parameter
          OracleParameter deptNoParam = new OracleParameter("deptno",OracleDbType.Int32);
          deptNoParam.Direction       = ParameterDirection.Input;
          deptNoParam.Value           = myArrayDeptNo;
          command.Parameters.Add(deptNoParam);
    
          // deptname parameter
          OracleParameter deptNameParam = new OracleParameter("deptname", OracleDbType.Varchar2);
          deptNameParam.Direction       = ParameterDirection.Input;
          deptNameParam.Value           = myArrayDeptName;
          command.Parameters.Add(deptNameParam);
    
          // loc parameter
          OracleParameter deptLocParam = new OracleParameter("loc", OracleDbType.Varchar2);
          deptLocParam.Direction       = ParameterDirection.Input;
          deptLocParam.Value           = myArrayDeptLoc;
          command.Parameters.Add(deptLocParam);
    
          try
          {
            connection.Open();
            command.ExecuteNonQuery();
            Console.WriteLine("{0} Rows Inserted", command.ArrayBindCount);
          }
          catch (Exception e)
          {
            Console.WriteLine("Execution Failed:" + e.Message);
          }
          finally
          {
            // connection, command used server side resource, dispose them
            // asap to conserve resource
            connection.Close();
            command.Dispose();
            connection.Dispose();
          }
        }
    
  • How to extract data from the APEX report with stored procedure?

    Hi all

    I am doing a report at the APEX. the user selects two dates and click on the GO button - I have a stored procedure linked to this region of outcome for the stored procedure is called.

    my stored procedure does the following-

    using dates specified (IN) I do question and put data in a table (this painting was created only for this report).

    I want to show all the data that I entered in the table on my APEX report the same procedure call. can I use Ref cursor return? How to do this?

    Currently, I use another button in the APEX that basically retrieves all the data from table. Basically, the user clicks a button to generate the report and then another button for the report. which is not desirable at all :(


    I m using APEX 3.1.2.00.02 and Oracle 10 database.

    pls let me know if you need more clarification of the problem. Thanks in advance.

    Kind regards

    Probashi

    Published by: porobashi on May 19, 2009 14:53

    APEX to base a report out of a function that returns the sql code... Your current code goes against a Ref cursor returns the values...

    See this thread regarding taking a ref cursor and wrapping it in a function to channel out as a 'table' (use a cast to cast tabular function vale)...

    (VERY COOL STUFF HERE!)

    Re: Tyring to dynamically create the SQL statement for a calendar of SQL

    Thank you

    Tony Miller
    Webster, TX

  • Compile with stored procedure errors

    Hi guys, I just start SQL so forgive me if I ask stupid questions real. That's the problem I have right now, as I said in my title.

    It's my procedure.sql

    CREATE OR REPLACE PROCEDURE check IS

    no_of_duplicates NUMBER: = 0;

    BEGIN

    SELECT COUNT (*) IN no_of_duplicates

    THE EMPLOYEE

    WHERE E # =.

    (select E # PILOT)

    WHERE THERE ARE

    (SELECT E # MECHANIC)

    WHERE DRIVER. L # = MECHANIC. L#));

    IF no_of_duplicates: = 0 THEN dbms_output.put_line ('OK');

    ON THE OTHER

    SELECT E #, NAME OF THE EMPLOYEE

    WHERE E # =.

    (SELECT E # PILOT)

    WHERE THERE ARE

    (SELECT E # MECHANIC)

    WHERE DRIVER. L # = MECHANIC. L#));

    END IF;

    END check;

    /

    While trying to create the procedure, it gives me compilation errors. I took with this for hours and can't seem to find anything wrong with it. Can someone point me in the right direction? Thank you!

    Hello

    Once again, your postal code.  The error occurs when you call the procedure, but you have not posted the code that calls the procedure and causes the error.

    When I do this in SQL * more:

    SET SERVEROUTPUT ON ENCAPSULATED FORMAT
    EXEC check;

    The procedure that you have posted works perfectly (i.e., displayed the e # is, exactly as it was designed to do).

    Display the e # and the name consists of BULK COLLECT both the e # name in separate collections, like this:

    CREATE OR REPLACE PROCEDURE check IS
    TYPE e #_table IS the TABLE OF THE employee.e#%TYPE;
    e # e _list #_table;

    TYPE name_table IS TABLE OF THE employee.name%TYPE;
    name_list name_table;
    BEGIN
    SELECT e #, name
    E LOOSE COLLECTION #_list, name_list
    The EMPLOYEE
    WHERE e # (IN)
    SELECT d.e #.
    DRIVER d
    JOIN m mechanic ON d.e # m.e = #.
    );
    E IF #_list. COUNT = 0
    THEN
    dbms_output.put_line ('OK, there without duplicate of illict");
    ELSE - that is to say, e #_list. COUNTY <> 0
    dbms_output.put_line (' the following employees are drivers and mechanics :');)
    J IN 1.e #_list. COUNTY LOOP - I displays parentheses sometimes hard on the OTN site
    dbms_output.put (TO_CHAR (e #_list (j)))
    '999999999999'
    )
    );
    dbms_output.put (' ');
    dbms_output.put_line (name_list (j));
    END LOOP;
    END IF;
    END check;
    /
    DISPLAY ERRORS

    This is the result I get when I run the procedure above with your sample data:

    The following employees are drivers and mechanics:

    1 John Smith

    You will notice I did several other changes in your code, sometimes because they are much more practical and sometimes just to show you different ways to do the same thing, that you may or may not want to use in this problem.

    For example, you were doing the same query (with only very slight differences) 2 times: once to get the no_of_duplicates and then a second time to get the actual data.  I don't know if it's the most effective way to do what you need.  Say that there are 1000 rows in the result.  You get all the 1000 once just to get the total number (that you do not need, if all you worry at this point is if there is), then to get the data.  When you make a COLLECTION in BULK, you get automatically the COUNTY anyway, so why not not COLLECTING in BULK, and then use this count to see what to do next.  If the NUMBER is greater than 0, then you already have the data, and you do not need to fetch it again.  In addition, repeating (essentially) the same code is a maintenance problem.  If you need to make a change, you must make the same change to several places.  At best, it's a pain; but it is the exactly the kind of mistake that is easy to miss in trials, and you could have the code that runs for weeks in Production before you notice that it sometimes gives false results.

    Another example: e # is a NUMBER.  If it is possible to convert numbers in VARCHAR2s and save these VARCHAR2s in a VARCHAR2 collection, would be unwise more just to store them in a collection of NUMBER?

  • CIAC 4.0 manual installation, problems with the procedure

    Hi all

    I m trying to install the latest version of the CIAC and I m facing some problems on the configuration phase.

    I m using the following document:

    Cisco_Intelligent_Automation_for_Cloud_4.0_Installation_Guide.PDF

    Downloaded from the portal of Cisco.

    On page 34, we can found the procedure for installing the adapter of REX.

    The procedure is very confused and not able to find where to put the REXAdapter.xml I m, that it points to C:\Rex\Deploy, but the CIAC device is based on linux and not able to find this file on the server of the portal I m.

    Also the adk.zip is absent from packs of automation CPO.

    Thanks in advance,

    Alex.

    The 4.0 unit has already installed RexAdapter. You can view the list of Service link adapters.

  • Problem with a procedure!

    Hello

    I have a procedure that I am trying to remove some unnecessary tables with her!

    It does not actually delete these tables after execution, you do have an idea why?

    CREATE OR REPLACE PROCEDURE SYS. MX3_DELETE_TEMPORARY(T_OWNER CHAR) AS

    BEGIN

    DECLARE

    cursor CS_RENSA IS

    Select OBJECT_TYPE,

    OBJECT_NAME

    FROM dba_OBJECTS WHERE

    ((NOM_OBJET COMME '% _TMP» ET OBJECT_NAME LIKE '%#%') OR)

    (OBJECT_NAME LIKE '% _TMPS' AND OBJECT_NAME LIKE ' %#%'))) AND THE OWNER = "T_OWNER";

    sqltxt tank (180);

    CS_OBJECT_TYPE CHAR (30);

    CS_OBJECT_NAME CHAR (30);

    BEGIN

    CS_RENSA OPEN;

    LOOP

    extract the CS_RENSA in CS_OBJECT_TYPE, CS_OBJECT_NAME;

    When the output CS_RENSA % notfound;

    SQLTXT: = 'DROP'. CS_OBJECT_TYPE | ' T_OWNER.'. CS_OBJECT_NAME;

    immediately run sqltxt;

    end loop;

    close CS_RENSA;

    end;

    end;

    /

    exec sys. MX3_DELETE_TEMPORARY ('TEST');

    Concerning

    / Hesi

    1. I agree with the suggestion above to use VARCHAR2 instead of CHAR, here and everywhere you have code, unless there is a real need for fixed-length strings and all their quirks.

    2. the slider has a predicate

    AND THE OWNER = "T_OWNER";

    who should be

    AND THE OWNER = T_OWNER;

    As it is now, I'm sure you're getting now lines of this slider.

    3. whenever restore you SQL to run like this, you should echo out before running it (at least while you are debugging. So, your code should look like this:

    dbms_output.put_line ('Executing: ' | sqltxt);

    immediately run sqltxt;

    This allow you to see what you are really doing and understanding errors that can be opposed to this SQL.

  • Problem with the procedure. Help, please

    Schema: HR

    Here is the procedure I created, when I compile the procedure it works very well and without errors or warnings are displayed. However, when I run, I get "01031. 00000 - "insufficient privileges" "error. "I tried 'GRANT ALL HR', 'ANY GRANT to HR'.," to HR WITH ADMIN OPTION GRANT ' nothing works. Not sure is code that has questions or privileges.

    create or replace procedure new_create_PROC IS
    BEGIN
    EXECUTE IMMEDIATE 'CREATE TABLE NEW_CREATE1(EMP_ID NUMBER,EMP_NAME VARCHAR2(20))';
    END;
    /
    
    
    EXECUTE new_create_PROC;
    
    TE new_create_PROC;
    /
    

    Help, please.

    You are connected to the DB under what user? You must grant this user the CREATE TABLE privilege.

  • problem of stored procedure

    Hello

    I use the following procedure to take input from the user parameters and insert it in the table. IF the record already exists the procedure updates the record with primary key emp_no

    ******************************************************************************
    create or replace procedure (v_emp_no in varchar2, v_ename in varchar2, v_sal in varchar2) as
    The CNT number;
    Start
    Select count (*) in the CNT from EMP where empno = v_empno;
    IF (cnt = 1)
    THEN
    UPDATE emp a set a.ename = v_ename, a.sal = v_sal where a.emp_no = v_emp_no;
    ON THE OTHER
    INSERT INTO emp (EMPNO, ENAME, SAL) values (v_emp_no, v_ename, v_sal);
    END IF;
    end;
    *******************************************************************************

    Suppose that a recording is already in the table

    emp_no ename sal
    -----------------------------
    Sachin 1234 2700

    The next time when the user from input parameters, it provided
    emp_no = 1234
    SAL = 3500
    jump the ename

    When I run the update process of the is null in the ename column

    My requirement is when the user provides the new value I have to update if not even old value should be updated.

    can someone help me?

    Thanks in advance,
    Balaji TK

    Hi, Barouk,

    One way is to use the NVL, take the existing value, every time the news is NULL:

    UPDATE      emp      a
    set      a.ename = NVL (v_ename, a.ename)
    ,     a.sal     = NVL (v_sal,   a.sal)
    where      a.emp_no = v_emp_no;
    

    The MERGE statement is designed to work like that. It checks to see if the row already exists, and then inserts a new line or updates the existing line, all in a single statement.
    Search in language SQL MERGE Manual:
    http://download.Oracle.com/docs/CD/B28359_01/server.111/b28286/statements_9016.htm#sthref9082

  • PROBLEM with my procedure (to COLLECT fees in BULK)

    This s my code

    CREATE OR REPLACE PROCEDURE BULK_COLLECT_tipo_per IS


    TYPE T_ARRAY_TAB IS TABLE OF tipo_per_22% ROWTYPE
    INDEX BY PLS_INTEGER;
    T_ARRAY_COL T_ARRAY_TAB;

    CUR cursor is located
    SELECT CIF_ID,
    MAX (C1) CL_ORI,
    MAX (C2) F_COTI,
    MAX (C3) EX_ORI,
    MAX (C4) F_EX_MAX
    FROM (SELECT / * + PARALLEL (C 8) * /)
    C.CIF_ID,
    MAX (NVL (DECODE (CANAL_ORIGEN, 'INDIRECTO', ' 1'),))
    DECODE (CANAL_ORIGEN, 'DIRECTO', ' 0'))) C1.
    NULL C2,
    NULL C3,
    C4 NULL
    OF DBM_PHOTO_POLARIS C
    CIF_ID GROUP
    UNION
    SEPARATE SELECT / * + PARALLEL (C 8) * / CIF_ID C.ID,.
    NULL C1,
    MAX (FECHA_PRESU) C2,
    NULL C3,
    C4 NULL
    OF EMI_PRESU_SOLIC@POLCP C
    WHERE FECHA_PRESU > SYSDATE - 730
    GROUP BY ID
    UNION
    SELECT / * + PARALLEL (C 8) * /.
    C.CIF_ID,
    NULL C1,
    NULL C2,
    MAX (NVL (DECODE (MAX_BAJA_INDIRECTO, THE OF ', '1'),))
    DECODE(MAX_BAJA_DIRECTO, 'S', '0'))) C3,.
    MAX (FECHA_PROCESO) C4
    OF MX_EX_CLIENTES_5ANOS C
    WHERE FECHA_PROCESO > SYSDATE - 1825
    AND (MAX_BAJA_INDIRECTO = S 'OR MAX_BAJA_DIRECTO = S')
    GROUP OF CIF_ID)
    CIF_ID GROUP;


    BEGIN
    HEART OPEN;
    LOOP

    COLLECT FETCH NEWS IN BULK
    IN THE T_ARRAY_COL LIMIT 100;

    FORALL I IN 1... T_ARRAY_COL. COUNTY
    INSERT INTO TIPO_PER_2
    (CIF_ID, CL_ORI, F_COTI, EX_ORI, F_EX_MAX)
    VALUES
    (T_ARRAY_COL (i). CIF_ID,

    T_ARRAY_COL (i). CL_ORI,
    T_ARRAY_COL (i). F_COTI,
    T_ARRAY_COL (i). EX_ORI,
    T_ARRAY_COL (i). F_EX_MAX);

    WHEN THE OUTPUT CUR % NOTFOUND;
    END LOOP;
    COMMIT;
    CLOSE THE HEART;

    END;


    And it comes error...

    Errors of compilation for the MARKETING of the PROCEDURE. BULK_COLLECT_TIPO_PER

    Error: PLS-00436: limitation of the implementation: cannot reference the fields in the table to LINK BULK records
    Online: 58
    Text: (T_ARRAY_COL (I). CIF_ID,

    Error: PLS-00382: expression is of the wrong type
    Online: 58
    Text: (T_ARRAY_COL (I). CIF_ID,

    Error: PLS-00436: limitation of the implementation: cannot reference the fields in the table to LINK BULK records
    Online: 59
    Text: T_ARRAY_COL (I). CL_ORI,

    Error: PLS-00382: expression is of the wrong type
    Online: 59
    Text: T_ARRAY_COL (I). CL_ORI,

    Error: PLS-00436: limitation of the implementation: cannot reference the fields in the table to LINK BULK records
    Line: 60
    Text: T_ARRAY_COL (I). F_COTI,

    Error: PLS-00382: expression is of the wrong type
    Line: 60
    Text: T_ARRAY_COL (I). F_COTI,

    Error: PLS-00436: limitation of the implementation: cannot reference the fields in the table to LINK BULK records
    Line: 61
    Text: T_ARRAY_COL (I). EX_ORI,

    Error: PLS-00382: expression is of the wrong type
    Line: 61
    Text: T_ARRAY_COL (I). EX_ORI,

    Error: PLS-00436: limitation of the implementation: cannot reference the fields in the table to LINK BULK records
    Line: 62
    Text: T_ARRAY_COL (I). F_EX_MAX);

    Error: PLS-00382: expression is of the wrong type
    Line: 62
    Text: T_ARRAY_COL (I). F_EX_MAX);

    Error: PL/SQL: ORA-22806: not an object or REF
    Online: 58
    Text: (T_ARRAY_COL (I). CIF_ID,

    Error: PL/SQL: statement ignored
    Online: 55
    Text: INSERT INTO TIPO_PER_2



    I try to solve this errors but I cant... help please

    Hello
    If the columns in the table do not match, you can try like this.
    Code is untested.

    BEGIN
    OPEN CUR;
    LOOP
    
    FETCH CUR BULK COLLECT
    INTO T_ARRAY_COL LIMIT 100;
    loop
    --FORALL I IN 1 .. T_ARRAY_COL.COUNT
    INSERT INTO TIPO_PER_2
    (CIF_ID , CL_ORI,F_COTI ,EX_ORI ,F_EX_MAX)
    VALUES
    (T_ARRAY_COL(i).CIF_ID,
    
    T_ARRAY_COL(i).CL_ORI,
    T_ARRAY_COL(i).F_COTI,
    T_ARRAY_COL(i).EX_ORI ,
    T_ARRAY_COL(i).F_EX_MAX);
    end loop;
    COMMIT;
    EXIT WHEN CUR%NOTFOUND;
    END LOOP;
    
    CLOSE CUR;
    
    END;
    

    Thank you

    Alen

  • MySQL stored procedure syntax errors

    I have a request online, I want to use transactions either commit all updates of db or anything. The code I created is as follows, not only am I getting an error of syntax on lines 5 and 16, but frankly I do not know that the code is really going to do what I want. Please let me know if you see syntax errors and explain them.

    CREATE PROCEDURE increase_maint_priority
        (maint_item INT, new_priority INT, cur_priority INT, center_id INT)
     
    BEGIN
        START TRANSACTION; -- line 5 syntax error
        -- start updates
        UPDATE maintitem SET priority = (priority+1) 
            WHERE priority > cur_priority
            AND priority <= new_priority
            AND centerID = center_id;
            
        UPDATE maintitem SET priority = new_priority
            WHERE id = maint_item;
        
        COMMIT;
    END; -- line 16 syntax error
    

    Thank you in advance for helping a newb to stored procedures.

    If you want to help me to know if this code will actually work for what I want, that the following describes the situation.

    Main idea: business location apply for maintenance at their Center. Applications can be added anywhere in the list of priority (1 = highest priority). They can also change the priority of an application at any time.

    Previously I was using php to control a loop of update mysql queries (ouch, I know now, 2 sql statements could do the trick) and we live lately priorities in double, and other problems which seem to be very likely related to the update of the priorities of several elements.

    Ex: moving priority 6 to priority 1 requires 1 update query because the current priority of the 6th point, but a second query (or loop of several others since I am very new to the drafting 2 years ago sql statements) to update the other priorities.

    Thus, the desire for transaction method.

    Once again, thanks in advance for any help on this matter.

    PS - I use MySQL workbench to write this and it's where to find errors.

    I do not use MySQL and its syntax is slightly different from the other DBMS stored procedures. In all cases, once you eliminate the warning, you also add a handler to ensure that updates roll back in case of error:

    http://khanrahim.WordPress.com/2010/05/16/transaction-with-stored-procedure-in-MySQL-serve r.

  • Problem with weakly typed ref Cursor

    I have problem with a procedure in a package that returns a weakly typed reference cursor.
    The cursor that is returned to give the desired result when connected as sys and sysdba.
    But the user has rights of execution on the slider isn't a result.
    If I run the query for the cursor as a user I get the desired result
    I tried creating a new procedure outside of the package and it still doesn't work the way I want it.

    I tested changing authentication none in sqlnet.ora and still no results

    Procedure
    create or replace procedure ReportUnits (in the SYS_REFCURSOR cResult)
    AS
    Start

    Open the cResult for
    Select distinct c.company, c.name, c.companycode
    all_views o, fakta.balance_table b, fakta.company c
    where b.company = c.company
    and o.view_name like upper(b.company ||) '_' || b.balance_table | '_view %');

    end ReportUnits;
    Tried the two SYS_REFCURSOR and
    Typedef t_cursor as ref cursor;

    I get no error message.

    802379 wrote:
    Sorry user_views does not solve the problem using all user_views I get no result points of view because interested does not belong to the user.

    So who owns the upper(b.company ||) '_' || b.balance_table | views of '_view' %)? And the package is created with copyrighted (by default) or with authid current_user? If the package is created with copyrighted, it still operates as package regardles of owner who runs it. Package owner (not the appellant) must have accsess to view granted directly, without going through role (rights define stored objects do honor no roles). And since rights define package runs as the owner of package, all_views will show views package owner has access, not package calling.

    One last thing - what happens if more than one schema has upper(b.company ||) '_' || b.balance_table | views of '_view' %)? Do you want them or only in a specific schema?

    SY.

Maybe you are looking for

  • problem opening document pages. Get the message: the requested index.xml file is missing.

    I can't open the document 'Pages' and get "the index.xml file required is missing."

  • Lion server is always available to purchase?

    I read some old posts that says you can buy Lion Server if you call Apple but I tried some numbers and all they have is Lion, but no server of Lion. Try to redirect some old Mac Pros such as file servers and hoping that it is possible to buy yet. Any

  • Memory extra ram for Satellite Pro 6100

    I want to expand the RAM but can not understand the difference between the 2 options listed. Can someone help, please 512 MB Memory Expansion PC2100 part number: PA3164U - 1 M 51512 MB Memory Expansion (DDR-PC2100/2700) part number: PA3312U - 1 M 51

  • Out of warranty, replacing a purchased phone antiques.

    If I bought a second hand iPhone damaged by water - that I had never used it myself - would it be eligible for out-of-warranty replacement? (In other words, could I legitimately replace on the Apple Store for a price)?

  • HP Simple Pass

    I need driver and software for Simple pass please. I can't find it here: http://h10025.www1.HP.com/ewfrf/wc/softwareCategory?OS=4158&LC=de&CC=de&DLC=de&sw_lang=&product=5307... which is weird... I have: Microsoft Windows 8.1 (64-bit) ENVY of HP dv7-7