String table as input to the procedure parameter

I was wondering if table string or integer can be passed as input to the procedure parameter. I created a procedure with parameter stringArray inside a package and do not know if this is the correct way to do or not and also I don't know how to test it. Here is my package and package body.
--Package 


CREATE OR REPLACE PACKAGE ARRAY_EXAMPLE AS

TYPE stringArrayVar IS TABLE OF VARCHAR2(1000);

PROCEDURE PROCESS_ARRAY(stringArrayIn  IN stringArrayVar
                       );

END;
/
Package body:
CREATE OR REPLACE PACKAGE BODY ARRAY_EXAMPLE AS

    PROCEDURE PROCESS_ARRAY(stringArrayIn IN stringArrayVar
                            ) IS   
    
    BEGIN
        
        FOR i IN 1..stringArrayIn.Count LOOP
          DBMS_OUTPUT.PUT_LINE('Hello '||stringArrayIn(i));
        END LOOP;
    
    EXCEPTION
        WHEN OTHERS THEN 
        NULL;
        
    END;

END;
/
Is this good way to pass the arrayString to the procedure.

And how do I test if it works or not.

I tried to call this procedure but did not work. I'm missing here something?
Declare
TYPE Str_Array IS TABLE OF VARCHAR2(1000);

BEGIN

 ARRAY_EXAMPLE.PROCESS_ARRAY(Str_Array('AAA','BBB','CCC','DDD'));

End;
/

Hello!

Type is defined in your package and... you can't call the procedure of your package with some type of similar/equal, but you must call
your procedure with the constructor of the type of the package itself

SQL>
SQL> set serveroutput on
SQL>
SQL> BEGIN
  2   ARRAY_EXAMPLE.PROCESS_ARRAY(array_example.stringArrayVar('AAA','BBB','CCC','DDD'));
  3  End;
  4  /
Hello AAA
Hello BBB
Hello CCC
Hello DDD

PL/SQL procedure successfully completed.

SQL> 

As it was written by you and it is with no syntax error, and then I used it as shown, I built your package.

T

Tags: Database

Similar Questions

  • tables as input for the shared library function

    I played with the call of LV VI using matlab.

    So I built a simple VI which returns an integer as input and multiply it by 10, I then put in a shared library and named it MATLAB - well.

    Now, I tried to do the same thing with a table - I want to send a picture to the VI and multiplied it by 10, but when I build the .h file, it seems that the function expects get table of entry AND exit of table as inputs.

    so, how I can build a shared library VI who gets an array (of a constant size if this is important) and multiply it by 10?

    Thank you!

    A function in a DLL can only return a scalar value, not a table, no matter what languages are used. To return an array, instead calling it allocates the array pass a reference to the DLL and then after the function called the referenced table table contains the new data. This is why there are two parameters - the input array (actually a pointer to it) and a pointer (reference) to the output array. You must change your code in MATLAB, there is nothing you can do about it in LabVIEW. EDIT: Also note that it allows to re-use of the input as an output table, optionally passing a reference only to the table of entry and then by changing that. You can do it in LabVIEW by configuring the setting table as input and output.

  • How to get the name and number of the procedure parameter list or a function?

    I stated the procedure described in the package

    If I want to get the number and the name of the parameter list, so how do I it

    I don't have I her name with the package.

    create or replace package demoApp is

    PROCEDURE insert_data (p_fname IN VARCHAR2,

    p_lname IN VARCHAR2,

    p_address IN VARCHAR2,

    p_cellno IN VARCHAR2,

    p_email IN varchar2);

    end demoApp;

    create or replace package demoApp body is

    PROCEDURE insert_data (p_fname IN VARCHAR2,

    p_lname IN VARCHAR2,

    p_address IN VARCHAR2,

    p_cellno IN VARCHAR2,

    p_email IN varchar2) IS

    EmpID number;

    BEGIN

    Select nvl (max (emp1.empid), 0) + 1 in EMP1 empid;

    INSERT INTO VALUES EMP1 (empid, p_fname, p_lname, p_address, p_cellno, p_email);

    EXCEPTION

    WHILE OTHERS THEN

    raise_application_error (-20001,' insert the problem ' |) SQLERRM);

    END;

    end demoApp;

    -----------------

    I want to get the name of the parameter and the number of use of stroredrprocedure ""demoApp.insert_data " "

    Select *.

    of all_arguments

    where package_name = 'DEMOAPP.

    and object_name = 'INSERT_DATA.

  • Change the input to the attribute parameter removes the binding in 5.5

    Hi all

    When I change an input variable already bound to a parameter in 5.5, it seems, when the dissociation there (and I need to re - link a parameter.). This was not the case in 5.1. Is there a way to restore this behavior to the 5.1 style.

    This is a regression and I opened a bug. I can't provide the bug number offshore now that I'm taking in 2 min

  • who to check the setting in the procedure or the oracle Packagusing Defualt table

    Hello

    My question is who to check the procedure parameter or a Package using the default oracle as a table

    user_procedure, we will have any kind of the PKG, PROCEDURE etc...

    same as if I wan't to see the partial procedure that eventually all the setting that to check?

    Hello

    870003 wrote:
    Hello

    My question is who to check the procedure parameter or a Package using the default oracle as a table

    user_procedure, we will have any kind of the PKG, PROCEDURE etc...

    same as if I wan't to see the partial procedure that eventually all the setting that to check?

    The data dictionary includes teas views:
    USER_PROCEDURES that has one row per stored procedure in your schema
    $user_arguments which has one line per parameter (or argument) to each stored procedure or a function in your schema
    USER_OBJECTS who has one line per package, package body, procedure or function in your schema. (It includes tables, synonyms, etc., but you can question him saying ' WHERE object_type IN ('PACKAGE', 'BODY of PACKAGE', 'PROCÉDURE', 'FUNCTION') ")
    USER_SOURCE who has one line of code in one of your packages, package bodies, procedures or functions

    There are also views starting with ALL_ (such as ALL_PROCEDURES, ALL_ARGUMENTS,...) for objects in any schema that you are authorized to use.
    There are also views starting with DBA_ (for example, DBA_PROCEDURES,...) for objects in any schema, if you have privileges on them or not, but you are not privileges to see the DBA_ views.

  • string table

    The input string is abc = 4, def = 5. I would like to string array of production with abc and def elements. delete the number including the equal sign... For this I used string table spread sheet and the format used % [^ = d *]. Any suggestions?

    Hi nik35324,

    You are so close to the result.

    Just delete would be "of the format string % [^ = d *] and use % [^ = *] "

    This will solve your problem.

  • simultaneous execution of the procedures

    I have a requrement in which I want to call different instances of a procedure of passing different parameter values at the same time. I am currently selecting data in a slider and make the entire process one by one. But this approach is time consuming. The only other way I know to fix the problem is to store the cursor data into a java array and then call the procedure for each value of the slider by Threading.

    The scenario is something like this:

    Create procedure prc_process
    is
    Start
    I'm in (departmentid selection of departments)
    loop
    ...
    some complexes of treatment which includes DML operations in the employee table, based on the departmentid
    ...
    end loop;
    end;

    Now, the employees table contains something around 20 million data.

    I want to have a such scenario for all departments in the departments table, I can call the procedure in this way:

    Create procedure prc_process (deptid number)
    is
    Start
    ...
    some complexes of treatment which includes DML operations in the employee table, based on the departmentid entry
    ...
    end;

    Personally, I'm not going to do such thing. I'd like to try to bring the list of departments in the basic procedure and try to do it in one fell swoop. Don't not passing one by one.

    But if this is not feasible and that you want to run the procedure for each service separately then Yes, submitting to a job is a way to allow a run in parallel.

  • Cannot run the procedure several times

    Hello

    I use oracle 12 c

    I just created a stored procedure that works very well

    Problem is that the second time I run it, it does not what it should (data fusion)

    When I run the second time I always get PL/SQL procedure successfully completed but the target table is still empty, here is the procedure:

    1 create or replace procedure MERGE_TABLEA

    2 as

    3. start

    4 MERGE TABLE_A has B (SELECT 'ID', 'NAME' OF TABLE_B) with the HELP of

    ON (A.ID = B.ID)

    WHEN MATCHED THEN

                     UPDATE SET B.SID = B.NAME

    WHEN NOT MATCHED THEN

    INSERT (A.' ID',' NAME')

    VALUES (B.ID, B.NAME);

    END;

    /

    PL/SQL procedure successfully completed.

    I also tried to build a simple procedure that id just insert and name of the table to test ina and it works very well, no matter how many times I've run it

    Is it maybe something with the merger or what?

    Thank you!

    OK guys, I think there are some misunderstandings here,

    @ddf_dba_ifox , version of the db that I use is stated in the first line of my post, I can't publish data for security reasons


    @rp0428 I forgot to mention that I'M to truncate the table, and then run the procedure again but the merger no longer works as the table is empty

    In any case, I found out why

    I'm merging the tables in the DB using the schema that is related to my installation of Oracle APEX

    In the procedure if you notice there is no COMMIT

    As apex has users within a schema, that I couldn't see the lines without committing before

    Thank you all anyway!

  • modify the INSTANCENAME parameter after the backup database

    Hello

    our primary database is configured as follows:

    SQL > show parameter db_name;
    VALUE OF TYPE NAME
    ------------------------------------ ----------- ------------------------------
    db_name string prod01


    SQL > show the INSTANCENAME parameter
    VALUE OF TYPE NAME
    ------------------------------------ ----------- ------------------------------
    instance_name string prod01

    the corresponding backup database is configured as:

    SQL > show parameter db_name;
    VALUE OF TYPE NAME
    ------------------------------------ ----------- ------------------------------
    db_name string prod01


    SQL > show the INSTANCENAME parameter
    VALUE OF TYPE NAME
    ------------------------------------ ----------- ------------------------------
    instance_name string stbyprod01

    Now, the standby database must be enabled. Later, I want to change the stbyprod01 to prod01 INSTANCENAME parameter.

    The question now is: what does take to change the INSTANCENAME parameter? In fact the database pending will be

    already be activated and be considered and treated as a stand-alone database. The former primary database will be used no more.

    I would like to do the following:

    SQL > create pfile = 'initprod01.ora' of spfile;

    SQL > shutdown immediate;

    Oracle # > change the pfile file and change the stbyprod01 to prod01 INSTANCENAME parameter

    SQL > startup;

    SQL > create spfile = 'spfileprod01.ora' of pfile;

    SQL > shutdown immediate;

    SQL > startup;

    That should be all - from my point of view (I know that LISTENER.) ORA and TNSNAMES. ORA should be modified, too).

    If someone has already experiences with the INSTANCENAME parameter change but sees some additional configurations: Please let me know!

    Rgds

    Jan

    1. you can use "alter system set instance_name" to change the value of the instance name.

    2. you must do the following to activate the standby database (NOTE:-this is only for the activation of the backup database and not the passage to digital database)

    1 startup nomount

    2. change the base of Mount Eve.

    3. change the database activate the database pending.

    4. change the database open.

  • Store of value returned by the procedure in the shell variable

    Hi gurus,

    I am trying to store THE return value of the procedure parameter in the variable shell like below;

    RET_VAL = "sqlplus $DB_USER / $DB_PASS < < EOT |" egrep. > $SCRIPT.tmp
    Set linesize 2500 pagesize 0 echo off road feedback off verify off
    Line of VARIABLE VARCHAR2 (4000)
    exec UPCStreamDiffNodeVersions($MStreamName,$oldVersion,$newVersion,:line);
    print the line;
    EOT'

    echo $RET_VAL

    I can print what is in the variable line, but can not enter in the $RET_VAL. Please suggest.

    Concerning
    Fox

    Solomon Yakobson says:

    EdStevens wrote:
    This not only would get the return code of execution of sqlplus itself

    NOP, he returned to any output (no return code) produced by SQL * Plus the term:

    create or replace
    procedure in_out(
    v_in varchar2,
    v_out out varchar2
    )
    is
    begin
    v_out := v_in;
    end;
    /
    

    prompt > export IN = EdStevens
    prompt > RET_VAL ='sqlplus-s /.<>
    Set feedback off
    Go head
    Line of VARIABLE VARCHAR2 (4000)
    exec in_out('$IN',:line);
    print the line;
    EXPRESSIONS OF FOLKLORE"
    prompt > echo $RET_VAL
    EdStevens
    Guest >

    SY.

    I was wrong. And after thinking it an another half minute... Well, of course!
    ;-)

  • Working with table gross typed the parameter of the procedure.

    I have a table defined as


    CREATE TABLE 'JOBS '.
    ("JOB_ID' VARCHAR2 (200 BYTE),
    'FUNCTION' RAW (16).
    NUMBER OF "MIN_SALARY."
    NUMBER OF "MAX_SALARY.
    )



    Defined as package

    create or replace package associative_array as
    type t_job_id is table of index jobs.job_id%type by pls_integer;
    type t_job_title is table of index jobs.job_title%type by pls_integer;
    type t_min_salary is table of index jobs.min_salary%type by pls_integer;
    type t_max_salary is table of index jobs.max_salary%type by pls_integer;

    procedure array_insert (p_job_id in t_job_id,
    p_job_title in t_job_title,
    p_min_salary in t_min_salary,
    p_max_salary to t_max_salary);
    end associative_array;
    /


    create or replace package body associative_array as
    procedure array_insert (p_job_id in t_job_id,
    p_job_title in t_job_title,
    p_min_salary in t_min_salary,
    p_max_salary to t_max_salary) is
    Start
    ForAll i in p_job_id.first... p_job_id. Last
    insert into jobs (job_id,
    function,
    min_salary,
    max_salary)
    values (p_job_id (i),
    p_job_title (i),
    p_min_salary (i),
    p_max_salary (i));
    end array_insert;
    end associative_array;
    /

    The client code is

    String s = "UserID = system; password = system; data source = ORCL; enlist = true; layout common = true ";

    create and open the connection object
    Con OracleConnection = new OracleConnection (constr.);
    con. Open();
    OracleCommand cmd = con. CreateCommand();
    cmd.CommandText = "associative_array.array_insert";
    cmd.CommandType = CommandType.StoredProcedure;

    create objects for each parameter setting
    OracleParameter p_job_id = new OracleParameter();
    OracleParameter p_job_title = new OracleParameter();
    OracleParameter p_min_salary = new OracleParameter();
    OracleParameter p_max_salary = new OracleParameter();

    set the type parameter for each parameter
    p_job_id. OracleDbType is OracleDbType.Varchar2.;
    p_job_title. OracleDbType = OracleDbType.Raw;
    p_min_salary. OracleDbType = OracleDbType.Decimal;
    p_max_salary. OracleDbType = OracleDbType.Decimal;

    Set the type of collection for each parameter
    p_job_id CollectionType in the Group OracleCollectionType.PLSQLAssociativeArray;
    p_job_title. CollectionType = OracleCollectionType.PLSQLAssociativeArray;
    p_min_salary. CollectionType = OracleCollectionType.PLSQLAssociativeArray;
    p_max_salary. CollectionType = OracleCollectionType.PLSQLAssociativeArray;

    Set the parameter values
    p_job_id. value = new string [3] {"IT_DBA", "IT_MAN", "IT_VP"};
    p_job_title. Value = new Guid [1] {Guid.NewGuid ()};
    p_min_salary. Value = new decimal [3] {8000, 12000, 18000};
    p_max_salary. Value = new decimal [3] {16000, 24000, 36000};

    set the size for each table
    p_job_id. size = 3;
    p_job_title. Size = 1;
    p_min_salary. Size = 3;
    p_max_salary. Size = 3;

    p_job_id. ParameterName = "p_job_id";
    p_min_salary. ParameterName = "p_min_salary";
    p_max_salary. ParameterName = "p_max_salary";
    p_job_title. ParameterName = "p_job_title";

    Add parameters to the collection of command objects
    cmd. Parameters.Add (p_job_id);
    cmd. Parameters.Add (p_job_title);
    cmd. Parameters.Add (p_min_salary);
    cmd. Parameters.Add (p_max_salary);

    BindByName. cmd = true;
    run the insert
    cmd ExecuteNonQuery());

    Error occurred during execution of the customer.

    Unhandled exception: System.ArgumentException: invalid parameter binding
    Parameter name: p_job_title
    at Oracle.DataAccess.Client.OracleParameter.GetBindingSize_Raw (Int32 idx)
    at Oracle.DataAccess.Client.OracleParameter.PreBind_Raw)
    to Oracle.DataAccess.Client.OracleParameter.PreBind (OracleConnection conn, IntPtr errCtx, Int32 arraySize)
    at Oracle.DataAccess.Client.OracleCommand.ExecuteNonQuery)

    But if I change jobs. P_job_title varchar2 and change function. Value and p_job_title. Therefore, any OracleDbType is fine.

    Following me is at fault-
    p_job_title. Value = new Guid [1] {Guid.NewGuid ()};

    Since you have already said-
    p_job_title. OracleDbType = OracleDbType.Raw;

    You must have 'p_job_title. Value' as 'Byte' or 'OracleBinary.

    It will be useful.

  • How to pass the content of the table as OUT of the stored procedure parameter

    Hi all

    I am writing a stored procedure where he must accept date as one of the parameters IN and it must interrogate the table of database on this criterion and should address data in a temporary table.

    in the end, he must send all the data from the temporary table as the OUT parameter.

    How to get there? should I create a new TYPE with all the columns in the Temp table and use this Type as a parameter? or SYS_REFCURSOR is the best option.

    Thanks in advance.

    Hello

    The best way to do what you want depends on what you want.  Start by describing what you need to do.  It is best to post some data examples (CREATE TABLE and INSERT statements), and what results you want from this sample data.  (See the FAQ forum: https://forums.oracle.com/message/9362002)

    If you have any ideas on how to do the work (for example, populating a temporary table) it may be useful to include those who, too, but a clear distinction between WHAT you do and HOW you do it.

    Bencol suggested, a SYS_REFCURSOR may be the best way to transmit the results.

    Since you only post your table, or even describe what you wanted to do with it, I will illustrate using scott.emp, which is probably on your system.

    Say you want a procedure that takes a DATE as an argument, then returned a certain designated columns (empno, ename, and hiredate in the example below) for all employees hired from the given DATE.  You can write a procedure like this:

    CREATE OR REPLACE PROCEDURE hired_since

    (IN start_date DATE

    out_data ON SYS_REFCURSOR

    )

    AS

    BEGIN

    OPEN FOR Out_data

    SELECT ename, empno, hiredate

    FROM scott.emp

    WHERE hiredate > = start_date;

    END hired_since;

    /

    DISPLAY ERRORS

    You can test it in SQL * more like this:

    VARIABLE c REFCURSOR

    EXEC hired_since (DATE ' 1982-01-01',: c);

    PRINTING: c

    The output I received this test was:

    ENAME, EMPNO, HIREDATE

    ---------- ---------- ---------

    7788 SCOTT APRIL 19, 87

    7876 ADAMS MAY 23, 87

    7934 MILLER JANUARY 23, 82

  • How to assign values to the nested table and passes as a parameter for the procedure?

    How to assign values to the nested table and passes as a parameter for the procedure?

    Here are the object and its type

    create or replace type test_object1 as an object
    (
    val1 varchar2 (50).
    val2 varchar2 (50).
    VARCHAR2 (50) val3
    );


    create or replace type test_type1 is table of the test_object1;


    create or replace type test_object2 as an object
    (
    val1 varchar2 (50).
    val2 varchar2 (50).
    VARCHAR2 (50) val3
    );


    create or replace type test_type2 is table of the test_object2;


    GRANT ALL ON test_object1 to PUBLIC;


    GRANT ALL ON test_type1 to PUBLIC;


    GRANT ALL ON test_object2 to PUBLIC;


    GRANT ALL ON test_type2 to PUBLIC;

    Here is the table object type:

    create the table test_object_tpe
    (
    sl_num NUMBER,
    Description VARCHAR2 (100),
    main_val1 test_type1,
    main_val2 test_type2
    )


    NESTED TABLE main_val1 STORE AS tot1
    NESTED TABLE main_val2 STORE AS earlier2;


    -----------------------------------------------------------------------------------------------------------

    Here is the procedure that inserts values into the nested table:

    PROCEDURE INSERT_TEST_DATA (sl_num in NUMBER,
    Description in VARCHAR2,
    p_main_val1 IN test_type1,
    p_main_val2 IN test_type2
    )
    IS
    BEGIN

    FOR rec in p_main_val1.first... p_main_val1. Last
    LOOP

    INSERT INTO xxdl.test_object_tpe
    (
    sl_num,
    Description,
    main_val1,
    main_val2
    )
    VALUES
    (
    sl_num
    description
    test_type1 (test_object1)
    p_main_val1 .val1 (CRE),
    p_main_val1 .val2 (CRE),
    p_main_val1 .val3 (rec)
    )
    )
    test_type2 (test_object2 (p_main_val2 .val1 (CRE),
    p_main_val2 .val2 (CRE),
    p_main_val2 .val3 (rec)
    )
    )

    );

    END LOOP;

    commit;

    END INSERT_TEST_DATA;

    -------------------------------------------------------------------------------------------

    Here are the block anonymoys what values attributed to the object type and pass values in the procedure:

    Set serveroutput on;

    declare

    p_sl_num NUMBER: = 1001;
    p_description VARCHAR2 (50): = 'Test Val1;

    inval1 test_type1: = test_type1();
    inval2 test_type2: = test_type2();

    Start


    inval1 (1) .val1: = "testx1";
    inval1 (1) .val2: = "testx2";
    inval1 (1) .val3: = "testx3";

    inval2 (1) .val1: = "testy1";
    inval2 (1) .val2: = "testy2";
    inval2 (1) .val3: = "testy3";

    CSI_PKG. INSERT_TEST_DATA (sl_num = > p_sl_num,)
    Description = > p_description,
    p_main_val1 = > inval1,
    p_main_val2 = > inval2
    );

    end;
    /
    Someone can correct me.

    Thank you
    Lavan

    Thanks for posting the DOF and the sample code but whenever you post provide your Oracle version 4-digit (result of SELECT * FROM V$ VERSION).
    >
    How to assign values to the nested table and passes as a parameter for the procedure?
    >
    Well you do almost everything bad that could be hurt.

    Here is the code that works to insert data into your table (the procedure is not even necessary).

    declare
    p_sl_num NUMBER := 1001;
    p_description VARCHAR2(50) := 'Testing Val1';
    inval1 test_type1 := test_type1();
    inval2 test_type2 := test_type2();
    begin
    inval1.extend();
    inval1(1) := test_object1('testx1', 'testx2', 'testx3');
    inval2.extend();
    inval2(1) := test_object2('testy1', 'testy2', 'testy3');
    
    INSERT INTO test_object_tpe
    (
    sl_num,
    description,
    main_val1,
    main_val2
    )
    VALUES
    (p_sl_num, p_description, inval1, inval2);
    commit;
    end;
    /
    

    See example 5-15 making reference to an element of nested Table Chapter 5 using PL/SQL collections and records in the PL/SQL doc
    http://docs.Oracle.com/CD/B28359_01/AppDev.111/b28370/Collections.htm#CJABEBEA

    1. you don't even have the procedure because it is a simple INSERTION in the table you can do directly (see my above code)

    inval1(1).val1 := 'testx1';
    

    Since you have not yet created all the elements, there is no element 1 "inval1". You need EXTEND the collection to add an element

    inval1.extend();
    

    And then, there is an empty element, but "inval1" is a container for objects of type 'test_object1' not for scalars as "val1", "val2", and "val3".
    If you can not do

    inval1(1).val1 := 'testx1';
    

    You must create an instance of 'test_object1 '.

    inval1(1) := test_object1('testx1', 'testx2', 'testx3');
    

    And so on for the other collection

    You don't need the procedure (as my code example shows), but once you fill in the variables correctly it will work.

  • How the parameter of the procedure with the default table type?

    Hello!

    How the parameter of the procedure with the default table type?
    For example:
    type varchar2lType is table of varchar2(50) index by binary_integer;
    create or replace procedure test1
       (
        s1  varchar2(50)
        sa2 Varchar2Type
       )
    as
    begin
       dbms_output.put_line('yyxxyyy!');
    end;
    /
    Published by: bullbil on 16.01.2012 06:35

    If he should really be an associative array for some reason any (can't think why, but just for fun...) you could declare a dummy array in the packet header and specify as the default:

    create or replace package wr_test
    as
       type varchar2ltype is table of varchar2(50) index by pls_integer;
       g_dflt_varchar2l_tab varchar2ltype;
    
       procedure testit
          ( p_testarray varchar2ltype default g_dflt_varchar2l_tab );
    end wr_test;
    
    create or replace package body wr_test
    as
       procedure testit
          ( p_testarray varchar2ltype default g_dflt_varchar2l_tab )
       is
       begin
          dbms_output.put_line('p_testarray contains ' || p_testarray.count || ' elements');
       end testit;
    
    end wr_test;
    

    It is a bit of a hack, because it relies on a global variable that is exposed. A more orderly approach would overload the procedure so that a version does not have the table and another argument:

    create or replace package wr_test
    as
       type varchar2ltype is table of varchar2(50) index by pls_integer;
    
       procedure testit;
    
       procedure testit
          ( p_testarray varchar2ltype );
    
    end wr_test;
    
    create or replace package body wr_test
    as
    
       procedure testit
       is
          v_default_array varchar2ltype;
       begin
          testit(v_default_array);
       end testit;
    
       procedure testit
          ( p_testarray varchar2ltype )
       is
       begin
          dbms_output.put_line('p_testarray contains ' || p_testarray.count || ' elements');
       end testit;
    
    end wr_test;
    
  • Comparing a constant string with the procedure VARCHAR2 parameter

    Hello.
    I had a strange behavior of PL/SQL (propably I don't know something I should). I have a procedure:
    PROCEDURE przetworzLinie(P_LINIA VARCHAR2) IS
    BEGIN
      if not (nvl(pv_swde_section,'...') = 'SO') then
        CASE (p_linia)
          WHEN 'SN;' THEN      pv_swde_section := 'SN';
          WHEN 'SP;' THEN      pv_swde_section := 'SP';
          WHEN 'ST;' THEN      pv_swde_section := 'ST';
          WHEN 'SO;' THEN      pv_swde_section := 'SO';
          ELSE  NULL;
        END CASE;
      end if;
    -- (...)
    END;
    The procedure is called breast:
    procedure importuj(p_plik varchar2) is
      linia VARCHAR2(1000);
    begin
      pv_plik := p_plik;
      pv_plikID := otworzPlik(pv_plik);
      loop
        linia := czytajlinie(swde_file);     -- calls UTL_FILE.read_line and return a line from file
        exit when instr(linia, 'SWDEX') = 1; -- end of SWDE file
        przetworzLinie(linia);
      end loop;
    end importuj;
    The strange thing is that this procedure przetworzLinie never change the pv_secton_swde package variable, because the expresion:
    WHEN 'SN;'
    is always FALSE, even when p_linia contains "SN;" string.

    I solved this problem by replacing
    CASE (p_linia)
    with
    CASE (substr(p_linia,1,3))
    Please explain to me, why CASE (p_linia) is malfunctioning.
    Thanks in advance :)

    Published by: sandrine Sep 2, 2010 08:59

    P.s., database is 10.2.0.3.0 (64-bit)

    Check the length of the parameter p_linia and maybe a few extra spaces are added.

Maybe you are looking for

  • Google Maps is no longer working in Firefox?

    I use FF 38.0.5 and just went to Google Maps and got this error message: "Your browser must be updated to use Google Maps" I'm blocking the features of Google Maps, so why I get this error message?

  • hour system of a gps receiver

    Hello. I use Labview 8.6. I managed to export data from a Garmin GPS receiver (on serial port). Ok. Now, I want to synchronize with my PC GPS, for the same time. How can I do?

  • HP Compaq mini 110 reset bios password

    Hello :) can someone help me unlock my mini compaq CNU9233JJG

  • Timeing TDS 3034 B using Ethernet VISA controls

    I'm trying to control an oscilloscope Tektronix TDS to 3034 B by Ethernet. I have set up the scope of Measurement & Automation Explorer and can't open a VISA session using the button "validate". However, when I use VISA test panel to write "* IDN? \n

  • can not install/uninstall a program

    Hey! I have problems installing/uninstalling programs. When I try to install/uninstall a program, he would say 'another program is installed. Please wait until installation is complete and then reinstall this software. "The problem is that I don't kn