PLS-00306 with DBMS_METADATA_DIFF

Oracle Database 11 g Enterprise Edition Release 11.2.0.3.0 - 64 bit Production

Hello
I try to use the package DBMS_METADATA_DIFF (http://docs.oracle.com/cd/E11882_01/appdev.112/e40758/d_metadiff.htm#ARPLS66923) to find out whether two schema objects are the same or not.

I want to check that OUT parameters 'diffs' domestic FETCH_CLOB can answer this question, but the following code gives me error PLS-00306: wrong number or types of arguments in the call to 'FETCH_CLOB' and I can't understand what I'm doing wrong here.

'Doc' FETCH_CLOB procedure is specified as "IN OUT NOCOPY CLOB", not requiring special attention?

Anyone?


CREATE TABLE T1 (X_ID NUMBER, X_NAME VARCHAR2(100));
CREATE TABLE T2 (X_ID NUMBER, X_NAME VARCHAR2(100));

DECLARE
  l_table_1 varchar2(30) := 'T1';
  l_table_2 varchar2(30) := 'T2';
  l_comp_handle number;
  l_sxml_1 clob;
  l_sxml_2 clob;
  l_doc clob;
  l_diffs boolean;
BEGIN  
  l_comp_handle := DBMS_METADATA_DIFF.OPENC (object_type => 'TABLE');
  l_sxml_1 := DBMS_METADATA.GET_SXML (object_type => 'TABLE', name => l_table_1, schema => user);
  l_sxml_2 := DBMS_METADATA.GET_SXML (object_type => 'TABLE', name => l_table_2, schema => user);
  DBMS_METADATA_DIFF.ADD_DOCUMENT (handle => l_comp_handle, document => l_sxml_1);
  DBMS_METADATA_DIFF.ADD_DOCUMENT (handle => l_comp_handle, document => l_sxml_2);
  LOOP
    DBMS_LOB.CREATETEMPORARY(l_doc, TRUE );
    DBMS_METADATA_DIFF.FETCH_CLOB(handle => l_comp_handle, doc => l_doc, diffs => l_diffs);
    EXIT WHEN l_doc IS NULL;
    DBMS_LOB.FREETEMPORARY(l_doc);
  END LOOP;
  DBMS_METADATA_DIFF.CLOSE(handle => l_comp_handle);
  IF l_diffs THEN
    DBMS_OUTPUT.PUT_LINE ('Tables are not equal');
  ELSE
    DBMS_OUTPUT.PUT_LINE ('Tables are equal');
  END IF;
EXCEPTION
  WHEN OTHERS THEN
    DBMS_LOB.FREETEMPORARY(l_doc);
    DBMS_METADATA_DIFF.CLOSE(handle => l_comp_handle);
END;
/

Let's not documentation.

In SQL * Plus, do a 'desc' dbms_metadata_diff and you will see that the real parameters of dbms_metadata_diff.fetch_clob are called "handle," "xmldoc", and "diffs."

It works (which is good, it runs - he's apparently an infinite loop):

DECLARE
  l_table_1 varchar2(30) := 'T1';
  l_table_2 varchar2(30) := 'T2';
  l_comp_handle number;
  l_sxml_1 clob;
  l_sxml_2 clob;
  l_doc clob;
  l_diffs boolean;
BEGIN
  l_comp_handle := DBMS_METADATA_DIFF.OPENC (object_type => 'TABLE');
  l_sxml_1 := DBMS_METADATA.GET_SXML (object_type => 'TABLE', name => l_table_1, schema => user);
  l_sxml_2 := DBMS_METADATA.GET_SXML (object_type => 'TABLE', name => l_table_2, schema => user);
  DBMS_METADATA_DIFF.ADD_DOCUMENT (handle => l_comp_handle, document => l_sxml_1);
  DBMS_METADATA_DIFF.ADD_DOCUMENT (handle => l_comp_handle, document => l_sxml_2);
  LOOP
    DBMS_LOB.CREATETEMPORARY(l_doc, TRUE );
    DBMS_METADATA_DIFF.FETCH_CLOB(handle => l_comp_handle, xmldoc => l_doc, diffs => l_diffs);
    EXIT WHEN l_doc IS NULL;
    DBMS_LOB.FREETEMPORARY(l_doc);
  END LOOP;
  DBMS_METADATA_DIFF.CLOSE(handle => l_comp_handle);
  IF l_diffs THEN
    DBMS_OUTPUT.PUT_LINE ('Tables are not equal');
  ELSE
    DBMS_OUTPUT.PUT_LINE ('Tables are equal');
  END IF;
EXCEPTION
  WHEN OTHERS THEN
    DBMS_LOB.FREETEMPORARY(l_doc);
    DBMS_METADATA_DIFF.CLOSE(handle => l_comp_handle);
END;
/

Once I removed the loop and it ran, it reports always tables are different - similar to this is because the names are different.

Edit: Here is a much simpler way:

SQL> ed
Wrote file afiedt.buf                                                            

  1  begin
  2  dbms_output.put_line(dbms_metadata_diff.compare_alter('TABLE', 'T1', 'T2'));
  3* end;
SQL> /
ALTER TABLE "HR"."T1" RENAME TO "T2"                                             

PL/SQL procedure successfully completed.

Tags: Database

Similar Questions

  • 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.

  • Custom authentication fails with PLS-00306: wrong number or types of argume

    Hello

    I wrote a custom authentication scheme. I have a function that returns a BOOLEAN. Now, when I tried to test it, he throwed the following error.

    < pre >
    ORA-06550: line 2, column 8: PLS-00306: wrong number or types of arguments in the call to 'AUTH_ON_MY_USERS' ORA-06550: line 2, column 1: PL/SQL: statement ignored
    ERR-10460 error cannot perform the function of verification of the authentication credentials.
    Ok
    < / pre >

    The function is
    < pre >
    create or replace function auth_on_my_users (p_username_in in varchar2
    p_password_in in varchar2)
    return a Boolean value
    is
    Start
    Returns true;
    end;
    < / pre >

    I have an Oracle 10 g XE on windows. Apex 3.2.1. When I tried the same thing in apex.oracle.com, it worked. Is there something to do with XE and 3.2.1?

    Any idea? Thanks in advance.

    Concerning
    Guru

    Published by: guru Perrin on November 23, 2009 19:44 - Typo

    Hello

    Try

    create or replace function auth_on_my_users( p_username in varchar2, p_password in varchar2)
    return boolean is
    begin
     return true;
    end;
    

    The engine requires Express provides this function to have the signature (p_username in varchar2, p_password in varchar2) return a Boolean value.
    >

    BR, Jari

  • Nested Tables: PLS-00306: wrong number or types of arguments

    Hello

    I created a package for updating of wages for a list of the empnos passed as parameter inside below is the package code:

    CREATE or REPLACE PACKAGE method

    AS

    type emp_list IS TABLE OF emp.empno%type;

    PROCEDURE add_sal (empnos emp_list);

    END method;

    /

    CREATE or REPLACE PACKAGE body method

    AS

    PROCEDURE add_sal (empnos emp_list)

    AS

    BEGIN

    ForAll I IN 1... empnos. Count

    UPDATE emp SET sal = sal plus 100 WHERE empno is empnos (i);

    END add_sal;

    END method;

    /

    When I try to call the procedure to aid under block it works fine:

    DECLARE

    empnos emp_info.emp_list: = emp_info.emp_list (1111,1112);

    BEGIN

    emp_info.add_sal (empnos);

    END;

    /

    But when I try to create the same as type I created in the package and try to pass to the procedure, the block fails with the error:

    DECLARE

    type emp_list IS TABLE OF emp.empno%type;

    empnos emp_list;

    BEGIN

    empnos: = emp_list (1111,1112);

    emp_info.add_sal (empnos);

    END;

    /

    Error report-

    ORA-06550: line 8, column 3:

    PLS-00306: wrong number or types of arguments in the call to 'ADD_SAL '.

    Can someone please help me understand why we see this error?

    With the help of: Windows 8.1

    Database Oracle 12 c Enterprise Edition Release 12.1.0.1.0 - 64 bit Production

    PL/SQL Release 12.1.0.1.0 - Production

    "CORE 12.1.0.1.0 Production."

    AMT for 64-bit Windows: Version 12.1.0.1.0 - Production

    NLSRTL Version 12.1.0.1.0 - Production

    But when I try to create the same as type I created in the package and try to pass to the procedure, the block fails with the error:

    No - it is NOT of the same type. One is the type of package and this news isn't the type of packet.

    The fact that they have the same projection or a set of attributes is obsolete.

    See the Oracle documentation

    http://docs.Oracle.com/CD/B28359_01/AppDev.111/b28370/Collections.htm#BEIEADAA

    You can assign values to all fields at the same time that if you assign a record to another record with the same data type. With fields that match exactly isn't enough, as shown in example 5-48.

    Example 5-48 assigning all the fields of a record in a statement

    DECLARE
    -Two declarations of the same types.
    TYPE DeptRec1 IS MADE
    (dept_num NUMBER (2), dept_name VARCHAR2 (14));
    TYPE DeptRec2 IS MADE
    (dept_num NUMBER (2), dept_name VARCHAR2 (14));
    dept1_info DeptRec1;
    dept2_info DeptRec2;
    dept3_info DeptRec2;
    BEGIN
    -Is not allowed; different types of data,
    -even if the fields are the same.
    -dept1_info: = dept2_info;
    -This assignment is OK because the files have the same type.
    dept2_info: = dept3_info;
    END;
    /

  • PLS 00306 evil type using DECODE


    Hello

    in the hope of finding a quick response and not look too stupid current...

    I have a PL/SQL procedure, I built using a save to spend a required group of data to a package values, I also built.

    Having eliminated all other errors, I finished with the error PLS 00306 wrong number or types of argument.

    To locate the offending entry...

    (1) I made a dummy copy of the procedure called (P1) and (R1) type of record in the package and that returns my driving procedure (P2).

    (2) I progressed to comment on data from a cursor for selecting data in a table P2 (SQL1) spent (P1) as a (R2) record and the corresponding (1) record (P1)

    (3) I enabled each pair of data until I found what column has generated the error.

    There were two...

    One is a field of NVARCHAR2 (F1) to enter in a NCLOB record item, SELECT

    (I'm pretty confident how to get around this - I can't just use a TO_NCLOB on F1 I use a SQL with database connection)

    The other is where I use a DECODE in SQL go to a NVARCHAR2 field (12) (F2)

    SQL1 simplified line... DECODE(COL1,'VAL1','VAL2') F1

    Here's the quesition *.

    I'm guessing that Oracle sees this as a generic string and not a NVARCHAR2 data type

    How can I change the SQL code to avoid the error?

    Thanks for your time (and be gentle with me, please).

    Elaine

    In fact using TO_NCHAR seems to have fixed - must be the string to NVARHCAR2 he had problems with.

    Thanks for posting... Elaine

  • Strange PLS-00306: wrong number or types of arguments

    We have the code in production and testing. the dbs, the servers are the same configuration. And two codes are the same (checked).

    Now all of a sudden the code on production for lack of sinus yesterday afternoon:

    BEGIN REQUEST_API. DBSS_process_FUDS; END;

    *
    ERROR on line 1:
    ORA-06550: line 1, column 93:
    PLS-00306: wrong number or types of arguments in the call to 'PROCESS_FUDS '.
    ORA-06550: line 1, column 93:
    PL/SQL: Statement ignored
    ORA-06512: at "SYS." Dbms_job", line 82
    ORA-06512: at "SYS." Dbms_job", line 140
    ORA-06512: at "ER. REQUEST_API', line 1190
    ORA-06512: at line 1

    Just with the test, it still works OK.

    Any idea? How can watch us?

    Thank you very much!

    The code can be the same (but you're not presenting the we a, then there's going to have to trust you on this), but what about data?
    And: are SQL * more guests of the same version as well?

    PLS-00306: wrong number or types of arguments in the call to 'string. '

    Cause: This error occurs when the named subprogram call cannot be matched to any statement for this subprogram name. Routine name can be spelled, a parameter can have the wrong data type, the statement may be defective or the statement may be
    placed correctly in the block structure. For example, this error occurs if the built-in square root SQRT function is called with a misspelled name or a parameter of the wrong data type.

    Action: Check the spelling and declaration of the name of routine. Also confirm that his appeal is correct, its parameters are of the right type of data, and, if it is not a built-in, that his statement is placed correctly in the block structure.

  • PLS-00306: wrong number or types of arguments in the call

    Hello

    I get this error when I run the script to test below:
    < font color = "red" >
    PLS-00306: wrong number or types of arguments in the call to 'SPLIT_AMOUNT '.
    < / make >

    This script is to test that the package below that I wrote. It seems to use the same 9 parameters of the same type:

    TEST SCRIPT+ *.
    declare
      TYPE g_table_number  IS TABLE OF  NUMBER INDEX BY BINARY_INTEGER;
      p_customer_trx_ids        g_table_number;
      p_total_amount_to_apply   NUMBER := 10;
      p_total_amount_to_adjust  NUMBER;  
       --
      p_result                  NUMBER;
      p_message                 VARCHAR2(200);
      p_payment_schedule_ids    g_table_number;
      p_terms_sequence_numbers  g_table_number;
      p_apply_amounts           g_table_number;
      p_adjust_amounts          g_table_number;
    begin
      p_customer_trx_ids(1)        := 23613;
      p_customer_trx_ids(2)        := 23614;
     hirap.split_amount
      (
       p_customer_trx_ids        
      ,p_total_amount_to_apply   
      ,p_total_amount_to_adjust 
      ,p_result                  
      ,p_message                
      ,p_payment_schedule_ids   
      ,p_terms_sequence_numbers 
      ,p_apply_amounts          
      ,p_adjust_amounts         
      );
      for i IN p_customer_trx_ids.FIRST .. p_customer_trx_ids.LAST LOOP
        dbms_output.put_line( 
        i || ' p_customer_trx_id: ' || p_customer_trx_ids (i) || ' p_apply_amounts(i): ' ||
         p_apply_amounts(i) || ' p_adjust_amounts: ' || p_adjust_amounts(i) );
      END LOOP;
    end;
    /
    PACKAGE+ *.
    CREATE OR REPLACE PACKAGE hirap
    AS
    TYPE g_table_number  IS TABLE OF  NUMBER INDEX BY BINARY_INTEGER;
    
    PROCEDURE split_amount
      (
       p_customer_trx_ids        IN   g_table_number
      ,p_total_amount_to_apply   IN   NUMBER
      ,p_total_amount_to_adjust  IN   NUMBER
       --
      ,p_result                  OUT  NUMBER
      ,p_message                 OUT  VARCHAR2
      ,p_payment_schedule_ids    OUT  g_table_number
      ,p_terms_sequence_numbers  OUT  g_table_number
      ,p_apply_amounts           OUT  g_table_number
      ,p_adjust_amounts          OUT  g_table_number
      );
    
    END hirap;
    /
    
    CREATE OR REPLACE PACKAGE BODY hirap
    AS
    PROCEDURE split_amount
      (
       p_customer_trx_ids        IN   g_table_number
      ,p_total_amount_to_apply   IN   NUMBER
      ,p_total_amount_to_adjust  IN   NUMBER
       --
      ,p_result                  OUT  NUMBER
      ,p_message                 OUT  VARCHAR2
      ,p_payment_schedule_ids    OUT  g_table_number
      ,p_terms_sequence_numbers  OUT  g_table_number
      ,p_apply_amounts           OUT  g_table_number
      ,p_adjust_amounts          OUT  g_table_number
      )
    IS
      l_total_pay_sched_amount   NUMBER;
      l_customer_trx_id          NUMBER;
      l_amount_due_remainings    g_table_number;
    
      CURSOR pay is
            SELECT p.payment_schedule_id
                  ,p.terms_sequence_number
                  ,p.amount_due_remaining
            FROM   ar_payment_schedules_all p
            WHERE  customer_trx_id = l_customer_trx_id
            AND    p.terms_sequence_number =
                  (SELECT  min(p1.terms_sequence_number)
                   FROM    ar_payment_schedules_all p1
                   WHERE   p1.customer_trx_id = l_customer_trx_id
                   AND     p1.status          = 'OP'
                  );
    
    
    BEGIN
      p_result := 0; -- means OK
    
      -- read the payment schedule for each transaction and store values and totals:
      FOR i IN p_customer_trx_ids.FIRST .. p_customer_trx_ids.LAST LOOP
        l_customer_trx_id          := p_customer_trx_ids(i);
        l_total_pay_sched_amount   := 0;
          BEGIN
            OPEN  pay;
            FETCH pay INTO
                   p_payment_schedule_ids(i)
                  ,p_terms_sequence_numbers(i)
                  ,l_amount_due_remainings(i);
    
            CLOSE pay;
            l_total_pay_sched_amount   := l_total_pay_sched_amount + l_amount_due_remainings(i);
         
          EXCEPTION WHEN NO_DATA_FOUND THEN
            fnd_file.put_line(fnd_file.LOG, 'Transaction does not exist for CUSTOMER_TRX_ID: ' ||
                              p_customer_trx_ids(i) );
            RAISE;
          WHEN OTHERS THEN
              RAISE;
          END;
      END LOOP;
    
      -- save values for each payment schedule based on total
      FOR i IN p_customer_trx_ids.FIRST .. p_customer_trx_ids.LAST LOOP
        p_apply_amounts(i)         := round
                                        (
                                         l_amount_due_remainings(i) / l_total_pay_sched_amount
                                         * (p_total_amount_to_apply + p_total_amount_to_adjust)
                                         , 2
                                        );
        p_adjust_amounts(i)        := l_amount_due_remainings(i) - p_apply_amounts(i);
    
      END LOOP;
    
    EXCEPTION
      WHEN OTHERS THEN
        p_result := 2;
        p_message := 'SQLCODE= ' || SQLCODE || ', SQLERRM = ' || SQLERRM;
        fnd_file.put_line( fnd_file.LOG , TO_CHAR(SYSDATE, 'HH24:MI:SS') || ' - ' || p_message );
    END;
    --
    END hirap;
    /
    Does anyone know what is the problem?

    Thank you
    Steve

    Hi, Steve,.

    The package contains a data type called g_table_number and also a procedure called split_amount.
    That does not create another data type (different), also called g_table_number, outside of the package, any more that it prevents you from creating another procedure, also called split_amount, also. When you want to reference the data type or the procedure outside the package from the package, then you must prefix the name with the name of the package. You do this correctly when you reference the name of the procedure of your anonymous block:

     hirap.split_amount
      (
       p_customer_trx_ids     ...
    

    Now you must do the same when you reference the data type:

    declare
      p_customer_trx_ids        hirap.g_table_number;
      p_total_amount_to_apply   NUMBER := 10;
      p_total_amount_to_adjust  NUMBER;
       --
      p_result                  NUMBER;
      p_message                 VARCHAR2(200);
      p_payment_schedule_ids    hirap.g_table_number;
      p_terms_sequence_numbers  hirap.g_table_number;
      p_apply_amounts           hirap.g_table_number;
      p_adjust_amounts          hirap.g_table_number;
    begin ...
    

    If you do not create another type of (different) data outside of the package, it will be the same as the type of data inside the packaging, even if the name is the same and they are defined in the same way. The package expects the arguments of the type hirap.g_table_number, so you have to give the hirap.g_table_number of type arguments.

  • Please help solve the problem error: PLS-00306: wrong number or types of a

    Hello

    Please see my statement of types and the procedure. Object and the nested table that is declared at the schema level

    I'm using the oracle version 11.2
    CREATE OR REPLACE TYPE T_COPY_EVNT_DTL IS OBJECT
    
    ( 
    
    eventId varchar2(100),
    
    eventDescription varchar2(100),
    
    promoMonthDescription varchar2(100),
    
    promoStartDate varchar2(100),
    
    promoEndDate varchar2(100),
    
    PROMOCOSTSTARTDATE varchar2(100)
    
    );
    
    
    CREATE OR REPLACE TYPE T_EVENT_TABLE IS TABLE OF T_COPY_EVNT_DTL;
    
    create or replace PROCEDURE Pr_Event_Details_new(ip_xml          CLOB,
                                                                                                                                                     op_sections_xml OUT XMLTYPE) AS
         
         event_list     t_copy_evnt_dtl;
         event_data_sec t_event_table := t_event_table();
         
         
         CURSOR get_event_cur IS
              SELECT cast(collect(t_copy_evnt_dtl(evnt.event,                                                                                                                    evnt.event_desc,
                        mth.promo_month_desc,
                        TO_CHAR(evnt.start_date,
                        'DD/MM/YYYY'),
                        TO_CHAR(evnt.end_date,
                        'DD/MM/YYYY'),
                        TO_CHAR((evnt.start_date - 21),
                        'DD/MM/YYYY'))) as
                        t_event_table)
                   FROM RETEK_PROMO_EVENT_MST evnt
               INNER JOIN  .....
               WHERE ... 
               ORDER BY evnt.event_desc,
                                       mth.promo_month_desc,
                                       dtl.promo_start_date,
                                       dtl.promo_end_date,
                                       dtl.promo_cost_start_date;
    
         type get_event_tab is table of get_event_cur%rowtype index by Binary_Integer;
         l_get_event_tab get_event_tab;
    BEGIN
    
         ....
         
         
              OPEN get_event_cur;
              fetch get_event_cur
                   into event_data_sec;
         
              event_data_sec := set(event_data_sec);
              ...
              
              
              
    EXCEPTION
              --log_errors...                                                                 
              Raise;
    END Pr_Event_Details_new;
    Error: PLS-00306: wrong number or types of arguments in the call to 'SET '.
    Online: 117
    Text: event_data_sec: = set (event_data_sec);

    Error: PL/SQL: statement ignored
    Online: 117
    Text: event_data_sec: = set (event_data_sec);

    You will raise a wrong number or types of argument error, or an exception of PLS-00306, if you use the fixed operator with the collection of user-defined object types.

    The collection must contain SQL scalar data types - single values without internal components...

    Numeric values, on which you can perform arithmetic operations.
    Alphanumeric values that represent individual or strings of characters, characters that you can manipulate.
    Logical values, on which you can perform logical operations.
    Dates and times, you can manipulate.
    Time intervals, you can handle.

    Published by: stefan nebesnak on January 24, 2013 13:22

  • Date arithmetic gives error PLS-00306

    Hi all
    SQL> select*from v$version;
    
    BANNER
    ----------------------------------------------------------------
    Oracle Database 10g Express Edition Release 10.2.0.1.0 - Product
    PL/SQL Release 10.2.0.1.0 - Production
    CORE    10.2.0.1.0      Production
    TNS for 32-bit Windows: Version 10.2.0.1.0 - Production
    NLSRTL Version 10.2.0.1.0 - Production
    Here is my code:
      1  declare
      2  v_date_time timestamp;
      3  v_dod  date;
      4  begin
      5  v_date_time:=to_date('11:20','HH12:MI AM');
      6  dbms_output.put_line('v_date_time ='||v_date_time);
      7  v_dod:=sysdate+v_date_time;
      8  dbms_output.put_line('v_dod ='||v_dod);
      9  exception when others then
     10  dbms_output.put_line('Error is'||sqlerrm);
     11* end;
    SQL> /
    v_dod:=sysdate+v_date_time;
           *
    ERROR at line 7:
    ORA-06550: line 7, column 8:
    PLS-00306: wrong number or types of arguments in call to '+'
    ORA-06550: line 7, column 1:
    PL/SQL: Statement ignored
    /
    How to add time with the minutes with sysdate otherwise...
    Please help me.

    And even using the arithmetic of the dates that uses the day as unit of measure (so 1 / 24 is an hour and a 1 / 24 / 60 is one minute):

    select  trunc(sysdate) + 11 / 24 + 20 /24 / 60 eleven_twenty_am_today
      from  dual
    /
    
    ELEVEN_TWENTY_AM_TO
    -------------------
    11/18/2012 11:20:00
    
    SQL>
    

    And:

    select  sysdate current_time,
            sysdate + 11 / 24 + 20 /24 / 60 current_time_plus_11_20
      from  dual
    /
    select  sysdate current_time,
            sysdate + 11 / 24 + 20 /24 / 60 current_time_plus_11_20
      from  dual
    /
    

    SY.

  • ORA-06550: line 1, column 7: PLS-00306: wrong number or types of arguments

    Hi all
    Here is the error:
    ORA-06550: line 1, column 7: PLS-00306: wrong number or types of arguments
    The following code generates the error:
    create or replace PROCEDURE AMENDNUMBER_UPDATE
    (
    SHIP_NUMBER IN VARCHAR2,
    AMEND_NO ON SYS_REFCURSOR)
    AS
    BEGIN
    UPDATE CSPS_SHIPMENT_INFO_TL
    SET AMENDMENT_NO =
    (SELECT AMENDMENT_NO + 1
    OF CSPS_SHIPMENT_INFO_TL
    WHERE SHIPMENT_NUMBER = SHIP_NUMBER
    )
    WHERE SHIPMENT_NUMBER = SHIP_NUMBER;

    AMEND_NO OPEN FOR SELECT AMENDMENT_NO FROM CSPS_SHIPMENT_INFO_TL WHERE SHIPMENT_NUMBER = SHIP_NUMBER;

    -VALIDATION;
    END AMENDNUMBER_UPDATE;

    now when I try to run the under statement I get the above error:
    exec amendnumber_update (ship_number);


    Please suggest how to manage...

    Hello

    TCSBPMUSER wrote:
    Hi all
    Here is the error:
    ORA-06550: line 1, column 7: PLS-00306: wrong number or types of arguments

    It's one of these error messages that actually means what he says.

    The following code generates the error:
    create or replace PROCEDURE AMENDNUMBER_UPDATE
    (
    SHIP_NUMBER IN VARCHAR2,
    AMEND_NO ON SYS_REFCURSOR)
    AS...

    now when I try to run the under statement I get the above error:
    exec amendnumber_update (ship_number);

    The procedure requires 2 arguments.
    You try to call with only 1 argument. It's the wrong number of arguments.

    To call the procedure from SQL * Plus, you can do something like this:

    VARIABLE   rc  REFCURSOR
    
    EXEC  amendnumber_update (123, :rc);
    

    The 1st argument is an argument IN, so you can pass any kind of digital expression. (I used a literal above.)
    The 2nd argument is an OUT argument, so you must pass a variable. (I used a variable link above.)

  • Create the table in the return procedure ON gets PLS 00306

    I would like to know the best way to do it. I am writing a procedure to create a table if it exists not as a select of.
    All I want to do is return a code completion to the calling program. My error is the wrong number of arguments in the call to create_tab,
    but all I want to do is return the completion code. PLS - 00306 wrong number or types of arguments in the call to Create_tab

    I wonder if the experts out there have a better implementation or suggestions for it.

    Thank you.

    Create or replace procedure create_tab (pstatus NUMBER) is

    sqltextheader varchar2 (200);
    sqltextfrom varchar2 (200);
    sqltextwhere varchar2 (200);
    sqltextdrop varchar2 (200);
    Whole CNT;
    p_err COMP. = 0 ;

    Start

    Select count (*) in the cnt from user_tables where table_name = 'TESTA. "

    DBMS_OUTPUT. Put_line ('cnt value is' | cnt);

    If (cnt = 1)
    then
    sqltextdrop: = 'drop testa table ";
    immediately run sqltextdrop;
    DBMS_OUTPUT. Put_line ('Table testa fell ');

    sqltextheader: = 'crΘer testa table as ";
    sqltextfrom: = ' select * from ssg_test';
    sqltextwhere: = ' where col_one > sysdate ";
    run immediately sqltextheader | '' || sqltextfrom: "| sqltextwhere;
    commit;

    pstatus: = pstatus + 1

    end if;

    If (cnt = 0)

    then

    sqltextheader: = 'crΘer testa table as ";
    sqltextfrom: = ' select * from ssg_test';
    sqltextwhere: = ' where col_one > sysdate ";
    run immediately sqltextheader | '' || sqltextfrom: "| sqltextwhere;
    commit;

    pstatus: = pstatus + 1

    exception
    while others then
    p_created: = pcreated + 2;
    DBMS_OUTPUT. Put_line ('error raised is value' | pcreated_;)
    end create_tab;
    /

    sgonos wrote:
    This effort is just to make code testing and does not come into production. So I need something
    to make a return code to the calling program.

    It's well :)

    So, Yes, the code is consistent, but I get an error on the number of arguments. I am writing this
    procedure for a developer so I don't know exactly its code, other than what he wants me to a return code
    for him.

    Can you show us how you (or 'the developer') call this program?

    If you have examples of this? Where I am confused in the entrance and exit of the parameters for the procedure...

    Generally, if you want to return a single value of a routine, you use a FUNCTION. But you would need to talk to 'the developer' to see what they expect it to come back... and why.

    If I only returns a code of State STATUS OF THE number then why oracle gives me error on the
    wrong number or type of variables. If I set the STATUS in the procedure, then I get an error
    variables in double. Where get set STATE?

    I don't know, I need to see an example of how you call it, but here's an example that you can run using SQLPLUS.

    Create or replace procedure create_tab
    (
      pstatus OUT number
    )
    authid CURRENT_USER
    is
    
      sqltextheader varchar2(200);
      sqltextfrom   varchar2(200);
      sqltextwhere  varchar2(200);
      cnt           integer;
    
    begin
    
      select
        count(*)
      into
        cnt
      from user_tables
      where table_name ='TESTA';
    
      DBMS_OUTPUT.PUT_LINE ('cnt value is ' || cnt);
    
      if cnt = 1
      then
        execute immediate 'drop table testa';
        DBMS_OUTPUT.PUT_LINE('Table testa is dropped');
      end if;
    
      sqltextheader := ' create table testa as   ';
      sqltextfrom   := ' select * from ssg_test  ';
      sqltextwhere  := ' where col_one > sysdate ';
      dbms_output.put_line(sqltextheader || sqltextfrom || sqltextwhere );
      execute immediate sqltextheader || sqltextfrom || sqltextwhere ;
      pstatus := 1;
    
    end create_tab;
    / 
    
    variable x number;
    exec create_tab(:x);
    print :x
    

    I added an AUTHID CURRENT_USER in the procedure. That means that this code executes with the privileges of the user running it, if this isn't something you are willing to have (the code runs with the permissions of the owner of the procedure otherwise)... just remove it.

  • Proc of PL/SQL call on submit process page returns "PLS-00306: fake...» »

    I have a very simple procedure call. The procedure takes 3 inputs: 2 numbers, and a Boolean value. Every time I try to run the page that calls the proc, I get
    "ORA-06550: line 1, column 7: PLS-00306: wrong number or types of arguments in the call to 'MISSED_DAY_CLASS' ORA-06550: line 1, column 7: PL/SQL: statement ignored."
    I ran the Debug page and values, it's the award appear to be 2 numbers and 1 boolean (TRUE). I executed the same values in the call to the proc outdoors using sql dev and proc call works fine.

    The Boolean value is set via a checkbox with this LOV element:
    STATIC2:; TRUE

    Any ideas are appreciated.
    Thank you
    Reid

    Hello

    I think that the value of the checkbox is not Boolean. It is text (VARCHAR).

    If you change the procedure as well as boolean is varchar2, it works then?
    Or in the process of Apex call differently for example

    IF :Px_YOUR_CHECKBOX = 'FALSE' THEN
     yourprocedure(:Px_NUMBER_ITEM1,:Px_NUMBER_ITEM2, FALSE);
    ELSIF :Px_YOUR_CHECKBOX = 'TRUE' THEN
     yourprocedure(:Px_NUMBER_ITEM1,:Px_NUMBER_ITEM2, TRUE);
    END IF;
    

    I hope you get photo off what I mean

    BR, Jari

  • PLS-00306: wrong number or types of arguments in call to... my cursor

    Hi all

    I try to use the same cursor for an explicit cursor and a cursor for loop. Can I do this? I get the error:
    PLS-00306: wrong number or types of arguments in call to
             'CUR_DEPT'
    This is my code:
         PROCEDURE LIST_DEPT_PRODUCTS (dept_name VARCHAR2)
         IS
          i_1 CHAR(1):=' ';
          i_2 CHAR(2):='  ';
          i_3 CHAR(3):='   ';
          i_4 CHAR(4):='    ';
          lv_deptid bb_department.idDepartment%TYPE;
          lv_deptname bb_department.DeptName%TYPE;
          lv_deptdesc bb_department.DeptDesc%TYPE;
          CURSOR cur_dept (dept VARCHAR2) IS
          SELECT d.DeptName, d.DeptDesc, d.idDepartment
          INTO lv_deptname, lv_deptdesc, lv_deptid
          FROM bb_department d 
          WHERE DeptName = dept
          ORDER BY DeptName;
           CURSOR cur_prod IS
           SELECT p.ProductName, p.Description, p.Price, p.SaleStart, p.SaleEnd
           FROM bb_product p 
           WHERE idDepartment = lv_deptid
           ORDER BY ProductName;
         BEGIN
         IF (dept_name = 'Coffee') THEN
           OPEN cur_dept(dept_name);
            LOOP
              FETCH cur_dept INTO lv_deptname, lv_deptdesc, lv_deptid;
              EXIT WHEN cur_dept%notfound;
                   DBMS_OUTPUT.PUT_LINE(lv_deptname);
                   DBMS_OUTPUT.PUT_LINE(i_1||lv_deptdesc);
                   DBMS_OUTPUT.PUT_LINE(chr(1));
              FOR l_prod in cur_prod LOOP
                   DBMS_OUTPUT.PUT_LINE(i_2||l_prod.ProductName);
                   DBMS_OUTPUT.PUT_LINE(i_3||SUBSTR(l_prod.Description,1,70));
                   DBMS_OUTPUT.PUT_LINE(i_4||'Price -  '||FORMAT_DOLLARS(l_prod.Price));
                   IF l_prod.SaleStart IS NOT NULL THEN
                   DBMS_OUTPUT.PUT_LINE(i_4||'Sale runs from '||FORMAT_DATE(l_prod.SaleStart)||' until '||FORMAT_DATE(l_prod.SaleEnd));
                   END IF;
                   DBMS_OUTPUT.PUT_LINE(chr(1));
            END LOOP;
           END LOOP;
           CLOSE cur_dept;
         ELSIF (dept_name = 'All') THEN
             FOR l_dept in cur_dept LOOP
                   DBMS_OUTPUT.PUT_LINE(l_dept.DeptName);
                   DBMS_OUTPUT.PUT_LINE(i_1||l_dept.DeptDesc);
                   DBMS_OUTPUT.PUT_LINE(chr(1));
              FOR l_prod in cur_prod LOOP
                   DBMS_OUTPUT.PUT_LINE(i_2||l_prod.ProductName);
                   DBMS_OUTPUT.PUT_LINE(i_3||SUBSTR(l_prod.Description,1,70));
                   DBMS_OUTPUT.PUT_LINE(i_4||'Price -  '||FORMAT_DOLLARS(l_prod.Price));
                   IF l_prod.SaleStart IS NOT NULL THEN
                   DBMS_OUTPUT.PUT_LINE(i_4||'Sale runs from '||FORMAT_DATE(l_prod.SaleStart)||' until '||FORMAT_DATE(l_prod.SaleEnd));
                   END IF;
                   DBMS_OUTPUT.PUT_LINE(chr(1));
            END LOOP;
           END LOOP;
           CLOSE cur_dept;
         ELSE
          DBMS_OUTPUT.PUT_LINE('No department found with name '||dept_name);
         END IF;
         END LIST_DEPT_PRODUCTS;
    Oh also if someone could tell me how to format DBMS_OUTPUT. Put_line so that I could dash in some lines that would be great. Did not work as I did.

    Thank you!

    Published by: user10915730 on April 18, 2009 07:48

    Published by: user10915730 on April 18, 2009 07:48

    Hello

    In the ELSIF clause, you must open the cursor. For dash maybe you can use:

    Connected to Oracle Database 10g Express Edition Release 10.2.0.1.0
    Connected as hr
    
    SQL>
    SQL> SET SERVEROUTPUT ON
    SQL> DECLARE
      2
      3     FUNCTION fnc_indent(nTimes IN NUMBER) RETURN VARCHAR2 IS
      4        v_result VARCHAR2(4000);
      5        c_tab CONSTANT VARCHAR2(1) := chr(9);
      6     BEGIN
      7        FOR i IN 1 .. nTimes LOOP
      8           v_result := v_result || c_tab;
      9        END LOOP;
     10        RETURN v_result;
     11     END fnc_indent;
     12
     13  BEGIN
     14     DBMS_OUTPUT.put_line(fnc_indent(1) || 'hello');
     15     DBMS_OUTPUT.put_line(fnc_indent(2) || 'hello');
     16     DBMS_OUTPUT.put_line(fnc_indent(3) || 'hello');
     17  END;
     18  /
    
         hello
              hello
                   hello
    
    PL/SQL procedure successfully completed
    
    SQL> 
    

    Kind regards

  • PLS-00306: wrong number or types of arguments in the call to "TO_CHAR.

    Hi guys, I learn Pl/SQL. Writing a simple function which allows to calculate dates. It takes contract_date and determines the date of the following Sunday.

    My current code has the compile error: PLS-00306: wrong number or types of arguments in the call to 'TO_CHAR' which I believe has to do with the to_char (trunc(contract_date,'D')): = contract_weekday;

    I don't understand what the problem with my return it...

    Here is my code: thanks for any help!

    display errors

    create or replace FUNCTION
    contract_dates(contract_date in date)
    DATE OF RETURN
    IS

    starting_sunday DATE;
    -DATE of ending_saturday: = starting_sunday + 6;
    contract_weekday varchar (32);
    days_add NUMBER;

    BEGIN

    TO_CHAR (trunc(contract_date,'D')): = contract_weekday;

    case contract_weekday
    When 1 then days_add: = 6;
    When 2 then days_add: = 5;
    When 3 then days_add: = 4;
    When 4 then days_add: = 3;
    When 5 then days_add: = 2;
    When 6 then days_add: = 1;
    Another days_add: = 7;

    end case;


    starting_sunday: = contract_date + days_add;

    To_date (starting_sunday) RETURN;

    END;

    It is the reverse:

    CREATE OR REPLACE FUNCTION
    contract_dates(contract_date IN DATE)
    RETURN DATE
    IS
    
    starting_sunday DATE;
    --ending_saturday DATE := starting_sunday + 6;
    contract_weekday varchar(1);
    days_add NUMBER;
    
    BEGIN
    
     contract_weekday := to_char(trunc(contract_date,'D'));
    
    case contract_weekday
    when 1 then days_add := 6;
    when 2 then days_add := 5;
    when 3 then days_add := 4;
    when 4 then days_add := 3;
    when 5 then days_add := 2;
    when 6 then days_add := 1;
    else days_add := 7;
    
    end case;
    
    starting_sunday := contract_date + days_add;
    
    RETURN to_date(starting_sunday);
    
    END;
    
  • Error: PLS-00306: wrong number or types of arguments

    Hello

    I created a function:

    create or replace procedure AS Test11
    x Test.Emp_No%Type;
    Begin
    Select emp_no in x from Test whose name = 'South '.
    x: = x + 1;
    Update Test set emp_no = x where emp_no < 100;
    commit;
    end Test11;

    It has compiled with success in PL/SQL Developer. Now, I created an executable of this procedure in front-end - 11i. And then I created a program of this executable. Then I added this program to a group of application.

    Now that I run this query and I get this error in the log:

    Error ORACLE 6550 in FDPSTP

    Cause: FDPSTP failed due to the ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in the call to 'TEST11 '.
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    .

    Hello
    Whenever you save a function, or a PL/SQL procedure as a simultaneous program to apps, you must
    to add two parameters of type varchar2 (errbuf and retcode) Moreover to your settings.
    If you change procedure as follows:

    create or replace procedure Test11(errbuf   out varchar2,
                                       retcode out varchar2) AS
    x Test.Emp_No%Type;
    Begin
    select emp_no into x from Test where name = 'Sud';
    x := x + 1;
    update Test set emp_no = x where emp_no < 100;
    commit;
    end Test11;
    

    Published by: Anthony Alix on December 3, 2008 05:20

    Published by: Anthony Alix on December 3, 2008 05:25

    Published by: Anthony Alix on December 3, 2008 05:35

Maybe you are looking for

  • New version of Firefox will not show images jpg/slide show!

    I throw it here once again... From last Friday (Nov 11), my site loaded perfectly with Firefox, but the next... nada. Jpg images inside a frame graphical rotation are more, but they don't appeary with Safari and 3.6.24 version. I've checked all my pl

  • Graphic driver GeForce 420Go

    HelloI find the most recent or the best driver for my 420 Go Driver installed.Can anyone help?I searchd in this Forum, but there is no positive results on this topic. Daniel so long!

  • Pavilion 15-n248sa: what processor speed is shown on the information sheet?

    I was recently going through all my stuff, work on which should be placed in a cell, when I found all the information about my computer sheets. On one of these journals, it says that I have an Intel Pentium Quad - Core 2.4 GHz processor N3520, but wh

  • Satellite L300D - 13 X - can't find it on the Toshiba site

    Hi all! I have a Toshiba Satellite L300D - 13 X But on the site Web of Toshiba, if I get his nr series, then he doesent get recognized. If instead of that, I use the small software that are supposed to log the computer model, which also fails to reco

  • Problem connecting a switch to a Linksys router.

    Hello I need a little help and I looked for a solution and tried some of the different proposals on other threads and nothing seems to work.  I have a Linksys WRT310N router wireless (most of the settings are enabled by default) connected to a cable