Passing & as parameter to procedure

How to pass & as a parameter to the procedure because & makes the text following it as a variable and ask for its value at runtime.
create or replace procedure test(name varchar2)
is
x varchar2(100);
begin
x:=name;
dbms_output.put_line(x);
end;
when procedure is executed without &
SQL> exec test('nan')
nan
PL/SQL procedure successfully completed.
when procedure is executed with &
SQL> exec test('nan & van')
Enter value for van: 1
nan 1
PL/SQL procedure successfully completed.
How to make '&' as a normal parameter.
thanks

SQL> create or replace procedure test(name varchar2)
  2  is
  3  x varchar2(100);
  4  begin
  5  x:=name;
  6  dbms_output.put_line(x);
  7  end;
  8  /
Procedure created.
SQL> exec test('nan')
nan
PL/SQL procedure successfully completed.
SQL> exec test('nan & van')
Enter value for van: 1
nan 1
PL/SQL procedure successfully completed.
SQL> set define off
SQL> exec test('nan & van')
nan & van
PL/SQL procedure successfully completed.
SQL>

Similar Messages

  • How to assign Values to nested table and pass as parameter to procedure?

    How to assign Values to nested table and pass as parameter to procedure?
    Below is the Object and its type
    create or replace type test_object1 as object
    val1 varchar2(50),
    val2 varchar2(50),
         val3 varchar2(50)
    create or replace type test_type1 is table of test_object1;
    create or replace type test_object2 as object
    val1 varchar2(50),
    val2 varchar2(50),
         val3 varchar2(50)
    create or replace type test_type2 is table of 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 made of object type:
    create 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 tot2;
    here is the procedure which inserts values into 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(rec).val1,
                                       p_main_val1(rec).val2,
    p_main_val1(rec).val3
    ,test_type2 (test_object2( p_main_val2(rec).val1,
                        p_main_val2(rec).val2,
                        p_main_val2(rec).val3
    END LOOP;
    commit;
    END INSERT_TEST_DATA;
    here is the anonymoys block which assigns values to the object type and pass values into the procedure:
    set serveroutput on;
    declare
    p_sl_num NUMBER := 1001;
    p_description VARCHAR2(50) := 'Testing Val1';
    inval1 test_type1 := test_type1();
    inval2 test_type2 := test_type2();
    begin
    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;
    Can anybody correct me.
    Thanks,
    Lavan

    Thanks for posting the DDL and sample code but whenever you post provide your 4 digit Oracle version (result of SELECT * FROM V$VERSION).
    >
    How to assign Values to nested table and pass as parameter to procedure?
    >
    Well you are doing almost everything wrong that could be done wrong.
    Here is code that works to insert data into your table (the procedure isn't even needed).
    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 Referencing a Nested Table Element in Chap 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 need the procedure since all it does is a simple INSERT into the table which you can do directly (see my code above)
    inval1(1).val1 := 'testx1';There is no element one (1) of 'inval1' since you haven't created any elements yet. You need to 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 like 'val1', 'val2', and 'val3'.
    So you can't do
    inval1(1).val1 := 'testx1';You have to 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 sample code shows) but once you populate the variables properly it will work.

  • How to pass the parameter of a stored procedure to iReport

    Hi... i don't know how to pass the parameter of the stored procedure to the iReport.
    In the Report Query, i tried
    1. sp_storedprocedure ' value'
    2. sp_storedprocedure +''''+$P{parameter}+''''+
    3. sp_storedprocedure +$V+$P{parameter}++$F($F is a variable having a value of ' (a single quote))may you enlighten us please? thank you

    For M$ SQL server I find that it only works when U use the fully qualified name...
    e.g. catalod.dbo.my_procedure_name 'variable'
    My full query in the Report Query window is something like this:
    EXEC arc.dbo.jasper_Invoice 1000
    Note that you may find that selecting from VIEWS / TABLES fails for no apparent reason and iReport will prompt you with the usual very unhelpful (we have what we "pay" for) prompt, stating that "The document is empty".
    To work around this issue, where a statement like "SELECT * FROM arc.dbo.acc_invoices WHERE Invoice_id=1000" does not work, simply create a PROC, something like:
    CREATE PROC jasper_MyProc (@my_rec_id integer) AS
    SELECT * FROM arc.dbo.acc_invoices WHERE Invoice_id= @my_rec_id integer
    ...to wrap your SELECT statement, then call the PROC
    Edited by: Sylinsr on Apr 22, 2008 4:23 PM

  • How to Pass multiple parameter into single store procedure

    How to Pass multiple parameter into single store procedure
    like a one to many relationship.
    it is possible then reply me immediatly

    you mean like this .....
    CREATE OR REPLACE procedure display_me(in_param in varchar2,in_default in varchar2 := 'Default') is
    BEGIN
    DBMS_OUTPUT.put_line ('Values is .....'||in_param || '....'||in_default);
    END display_me;
    CREATE OR REPLACE procedure display_me_2 as
    cnt integer :=0;
    BEGIN
    For c1_rec In (SELECT empno,deptno FROM test_emp) Loop
         display_me(in_param => c1_rec.empno);
         cnt := cnt+1;
         end loop;
         DBMS_OUTPUT.put_line('Total record count is ....'||cnt);
    END display_me_2;
    SQL > exec display_me_2
    Values is .....9999....Default
    Values is .....4567....Default
    Values is .....2345....Default
    Values is .....7369....Default
    Values is .....7499....Default
    Values is .....7521....Default
    Values is .....7566....Default
    Values is .....7654....Default
    Values is .....7698....Default
    Values is .....7782....Default
    Values is .....7788....Default
    Values is .....7839....Default
    Values is .....7844....Default
    Values is .....7876....Default
    Values is .....7900....Default
    Values is .....7902....Default
    Values is .....7934....Default
    Values is .....1234....Default
    Total record count is ....18

  • Pass DB Link in procedure as parameter.

    Hi,
    I am using ORACLE Database 11g .
    I have a procedure in which i am already passing some parameters. The procedure contains few statements in which it has to refer to specific user for getting the data. So we use DB Link. As which user to connect is not sure so the DB LINK is also not constant. That is why i want to pass the DB link as a parameter to procedure. But if i don't give the db link name in procedure the procedure will not compile.
    A sample of my code is as follows :-
    create or replace procedure P_GET_TABLES(V_DBLINK in varchar2)
    as
    FOR I in (select s.TABLE_NAME
                    from user_tables@V_DBLINK s, dba_tables d          --- Obviously it gives me error that table does not exists.Due to variable V_DBLINK
                   where d.table_name = s.TABLE_NAME
                     and s.TABLE_NAME != 'ERROR_LOG'
                     and d.owner = V_SOURCE_SCHEMA_NAME
                  union (select s.TABLE_NAME
                          from user_tables@V_DBLINK s
                        minus
                        select TABLE_NAME
                          from dba_tables d
                         where owner = V_SOURCE_SCHEMA_NAME)) Loop
    -- other code for the process.....
    END LOOP;
    END;
    /Is their any method that i can pass a compiled procedure DB LINK as parameter or at run-time. ??
    Thanks in advance.

    VIRU wrote:
    Its a request can you just do the same thing with the FOR LOOP given by me in the first post. It will look something like this:
    create or replace procedure P_GET_TABLES
        (V_DBLINK in varchar2
          , V_SOURCE_SCHEMA_NAME  in varchar2)
    as
        rc sys_refcursor;
        l_table_name all_tables.table_name%type;
    begin
        open rc for 'select s.table_name
                    from user_tables@'||V_DBLINK||' s, dba_tables d
                   where d.table_name = s.table_name
                     and s.table_name != ''ERROR_LOG''
                     and d.owner = :1
                  union (select s.table_name
                          from user_tables@'||V_DBLINK||' s
                        minus
                        select table_name
                          from dba_tables d
                         where owner = :1)'
        using V_SOURCE_SCHEMA_NAME, V_SOURCE_SCHEMA_NAME;
       loop
            fetch rc into l_table_name;
            exit when rc%notfound;
            --  do your processing here....
       end loop;
       close rc;
    end P_GET_TABLES;
    /The Oracle online documentation covers dynamic SQL quite comprehensively. [url http://docs.oracle.com/cd/B19306_01/appdev.102/b14261/dynamic.htm#i14500]Find out more.
    I think you have some confusion with the data dictionary views you're using, USER_TABLES@remote_db will look for tables in a schema with the same name as the current user in the local database. The current user in the local database has the privileges to read the DBA_ level views in te local data dictionary but apparently isn't the account owning the tables in the remote database.
    Is that right? It sounds like a mess. I have to [url https://forums.oracle.com/forums/thread.jspa?messageID=10062119#10062119]agree with Billy that you might be trying to solve the wrong problem. Perhaps you need better configuration/release management processes?
    Cheers, APC
    Edited by: APC on Jan 2, 2012 9:52 AM

  • In plsql webservice how can i pass a number parameter to procedure

    hi
    i use eclipselink and jdeveloper 11 g to create pl/sql webservice. i create a session bean and i right click it and get a option for a creating a webservice.
    i have number data types in the procedure. but i can pass the parameter only strings.
    i paste the code below which i wrote
    public void UpdateActi(Number ACT_ID,Date FORWARDED_DATE
    Session session = sessionFactory.getSharedSession();
    StoredProcedureCall spcall = new StoredProcedureCall();
    spcall.setProcedureName("ACTIVITY_UPDATE_WS.ACTIVITY_UPDATE");
    spcall.addNamedArgument(ACT_ID);
    spcall.addNamedArgument(FORWARDED_DATE);
    session.executeSelectingCall(spcall);
    i get error can use only strings
    thanks in advance
    regards rajesh

    no need to be dynamic:
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:73830657104020
    Regards
    Etbin

  • Error while pass parameter to procedure....

    We have developed procedure with parameter ORG_ID (Number) then create executable and define program. When we execute this executable and pass ORG parameter, we get following error, pl help in this regard:
    Data type of parameter and column is same
    Cause: FDPSTP failed due to ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'COST_ELEMENT_UPDATION_CUST'
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored

    procedure works in pl/sql developer but when we define as "PL/SQL Stored Procedure" in application it prompt error.
    CREATE OR REPLACE PROCEDURE Cost_Element_Updation_Cust(P_ORG IN number) IS
    --P_ORG NUMBER(10) := 91;
    BEGIN
    --FOR 1PP ORG, for average costing header line
    INSERT INTO CST_ITEM_COSTS
    SELECT M.INVENTORY_ITEM_ID,
    M.ORGANIZATION_ID,
    C.COST_TYPE_ID,
    SYSDATE,
    C.LAST_UPDATED_BY,
    SYSDATE,
    C.CREATED_BY,
    C.LAST_UPDATE_LOGIN,
    C.INVENTORY_ASSET_FLAG,
    C.LOT_SIZE,
    C.BASED_ON_ROLLUP_FLAG,
    C.SHRINKAGE_RATE,
    C.DEFAULTED_FLAG,
    C.COST_UPDATE_ID,
    C.PL_MATERIAL,
    C.PL_MATERIAL_OVERHEAD,
    C.PL_RESOURCE,
    C.PL_OUTSIDE_PROCESSING,
    C.PL_OVERHEAD,
    C.TL_MATERIAL,
    C.TL_MATERIAL_OVERHEAD,
    C.TL_RESOURCE,
    C.TL_OUTSIDE_PROCESSING,
    C.TL_OVERHEAD,
    C.MATERIAL_COST,
    C.MATERIAL_OVERHEAD_COST,
    C.RESOURCE_COST,
    C.OUTSIDE_PROCESSING_COST,
    C.OVERHEAD_COST,
    C.PL_ITEM_COST,
    C.TL_ITEM_COST,
    C.ITEM_COST,
    C.UNBURDENED_COST,
    C.BURDEN_COST,
    C.ATTRIBUTE_CATEGORY,
    C.ATTRIBUTE1,
    C.ATTRIBUTE2,
    C.ATTRIBUTE3,
    C.ATTRIBUTE4,
    C.ATTRIBUTE5,
    C.ATTRIBUTE6,
    C.ATTRIBUTE7,
    C.ATTRIBUTE8,
    C.ATTRIBUTE9,
    C.ATTRIBUTE10,
    C.ATTRIBUTE11,
    C.ATTRIBUTE12,
    C.ATTRIBUTE13,
    C.ATTRIBUTE14,
    C.ATTRIBUTE15,
    C.REQUEST_ID,
    C.PROGRAM_APPLICATION_ID,
    C.PROGRAM_ID,
    C.PROGRAM_UPDATE_DATE,
    C.ROLLUP_ID,
    C.ASSIGNMENT_SET_ID
    FROM APPS.CST_ITEM_COSTS C, APPS.MTL_SYSTEM_ITEMS_B M
    WHERE C.INVENTORY_ITEM_ID =
    (SELECT ITEM_ID FROM IFL.COST_ELEMENT_CUST WHERE ORG_ID = P_ORG) AND
    C.ORGANIZATION_ID = P_ORG AND C.COST_TYPE_ID = 1002 AND
    M.SEGMENT3 = 'IMPORTED' AND
    M.SEGMENT1 IN ('F ASSET', 'SPARES', 'TOOLS', 'STORES') AND
    M.ORGANIZATION_ID = P_ORG
    --AND M.INVENTORY_ITEM_ID=154540
    --Get item from cost which are pending for costing
    AND M.INVENTORY_ITEM_ID NOT IN
    (SELECT DISTINCT INVENTORY_ITEM_ID
    FROM apps.CST_ITEM_COST_DETAILS_V
    WHERE COST_TYPE_ID = 1002 AND ORGANIZATION_ID = P_ORG);
    COMMIT;
    END Cost_Element_Updation_Cust;

  • How to execute a procedure with collection passed as parameter?

    i have created the collection:
    CREATE TYPE typ_Project AS OBJECT( project_no NUMBER(2), title VARCHAR2(35), cost NUMBER(7,2))
    CREATE TYPE typ_ProjectList AS VARRAY (50) OF typ_Project
    and a procedure:
    CREATE OR REPLACE PROCEDURE add_project (
    p_deptno IN NUMBER,
    p_new_project IN typ_Project,
    p_position IN NUMBER )
    IS
    v_my_projects typ_ProjectList;
    BEGIN
    SELECT projects INTO v_my_projects FROM department
    WHERE dept_id = p_deptno FOR UPDATE OF projects;
    v_my_projects.EXTEND;
    FOR i IN REVERSE p_position..v_my_projects.LAST - 1 LOOP
    v_my_projects(i + 1) := v_my_projects(i);
    END LOOP;
    v_my_projects(p_position) := p_new_project; -- add new
    UPDATE department SET projects = v_my_projects
    WHERE dept_id = p_deptno;
    END add_project;
    Now please explain how to call this procedure with collection passed as parameter . . .

    For example:
    BEGIN
        add_project(
                    10, -- department number
                    typ_Project(
                                99, -- project number
                                'New Project', -- project title
                                99999.99 -- project cost
                               ), -- new project
                    5 -- project position
    END;
    /SY.

  • Passing a Parameter to the Procedure and changing it in the Procedure

    Hi all,
    I am trying to pass a parameter to a procedure like this.
    PROCEDURE FLASH_PHY
    (date_begin IN DATE, date_end IN DATE)
    IS
    I am trying to do SELECT and INSERT based on the date range passed in the procedure as mentioned above. And I am trying to do something like this.
    SELECT NVL(sum(charges),0),count(summary_balances_id)
    INTO lnu_charges_6months,c_summary
    FROM SUMMARY_BALANCES
    WHERE period_begin BETWEEN ADD_MONTHS((date_begin), -6) -- AND ADD_MONTHS((date_end), -1);
    UPDATE summary_balances
    SET cummulative_charges_6mo = lnu_charges_6months;
    how should I do this parameter change. Right now if I use this select statement than it does not return anything as the parameter is passed on the procedure level. I am under the impression that when you pass a parameter to the procedure like this you can't change it into the procedure.
    PLEASE GUIDE. Thanks a bunch. I really appreciate it.

    From what I understand your variables that are passed into the
    procedure can be manipulated as local variable to the procedure.
    Here is my interpretation of what your attempting to do:
    create or replace procedure A (x in number) IS
    yes varchar2(3) := 'No';
    begin
    dbms_output.put_line('Start value for yes:'||yes);
    select 'yes' into yes from dual where x+1 = 2;
    dbms_output.put_line('End value for yes:'||yes);
    end;
    Call the procedure called "A" passing in a "1".
    EG:
    BEGIN
    A(1);
    END;
    Does this answer your question?
    ,Russ

  • How can i pass the  parameter for strored procedure from java

    dear all,
    I am very new for stored procedure
    1. I want to write the strored procedure for insert.
    2. How can i pass the parameter for that procedure from java.
    if any material available in internet create procedure and call procedure from java , and passing parameter to procedure from java

    Hi Ram,
    To call the callable statement use the below sample.
    stmt = conn.prepareCall("{call <procedure name>(?,?)}");
    stmt.setString(1,value);//Input parameter
    stmt.registerOutParameter(2,Types.BIGINT);//Output parameter
    stmt.execute();
    seq = (int)stmt.getLong(2);//Getting the result from the procedure.

  • Passing parameter to procedure in apackage

    Hi All,
    I have a doubt regarding the parameter we pass in the procedure of a package.
    There is a package with the name pack1. pack1 is havina procedure called proc1 which is have 3 parameter like
    proc1(p_name,p_dob,pack1.fn1(p_dob)) where fn1 is the function defined in the package which calculate the age of the person. Can I pass the parameter like
    proc1(p_name,p_dob,'Age of the employee'||pack1.fn1(p_dob)). Actually I can append this inside the function only but I want to explicitily call this procedure two places with 2 diff parameters like once:
    proc1(p_name,p_dob,'Age of the employee'||pack1.fn1(p_dob))
    and second time like
    proc1(p_name,p_dob,'Age of the manager'||pack1.fn1(p_dob))
    Is this possible to pass the parameters like this.
    Thanks.
    Edited by: user12841217 on Apr 6, 2010 4:08 AM

    Provided that:
    the third parameter is some kind of string datatype or a type that can be implicitly converted from string
    the third parameter is declared as IN only
    ..then it will work
    Oracle will run the function, get its output, append to to the string, creating a new string and pass the new string into the procedure
    If the third parameter has an OUT modifier, you must store the text 'Age of the xXX '||fnwhatever() in a variable, then pass the variable name before you call the procedure, or you'll get an error something like "proc1 has out arguments"

  • Passing dynamic parameter to stored procedure from CR formula?

    Dear all,
    I need to insert in some textboxes the right string based on the desired Language Code.
    I crated a stored procedure in my db.
    CREATE PROCEDURE MY_GET_TRANSLATION
         @TextID nvarchar(8),
         @LangCode int
    This parameters are used as keys to get the Trans field.
    I created a workshop formula: GetTranslation
    Please, can someone suggest the correct statement to call my MY_GET_TRANSLATION  stored procedure passing parameters?
    I would like to call the GetTranslation formula from all my textboxes, passing the specific TextID value
    and visualized the right translated string.
    For example:
    in my TEXT1 textbox, I would like to call the GetTranslation formula passing the parameters
    TextID = "T000001"
    and
    LangCode = 13    (Italian language)
    How can pass dynamic parameters to a formula?
    How can pass dynamic parameters to a stored procedure from a CR formula?
    Regards
        Emanuele

    Dear Jason,
    I'm trying to modify a SAP B1 CR marketing report.
    This CR marketing document is called by SAP B1 automatically passing the Document Number and Document Type.
    The report uses the right SAP B1 tables to read the information of the header and rows of the document.
    The language of the document is contained in a field of the header table
    {MyMarketingDocTable.LanguageID}
    I created a user table named "MyTranslationTable" where I added some strings in different langiages.
    For example:
    TexiID            TextString              LangID
    T00001          Delivery                          8      
    T00001          Consegna                     13       (Italian translation)
    T00002          Invoice                           8
    T00002          Fattura                         13       (Italian translation)
    In the header of the report I'd like, for example, to visualise the string "Consegna" if my document is a delivery in italian language.
    I'd like to implement this method to translate all the textboxes (header, comments, etc.) based on the languageID of my document.
    For each textboxes, in the CR designer statically I know what TextID I want to visualized but dinamically I need to pass to my stored procedure the right language. I'd like my report automatically gets the language at run-time. I don't want that when I press the Print-preview button in SAP B1, the report asks to prompt the languageID.
    It already read the DocNum and DocType and it already filter the SAP B1 tables basing on the DocNum and DocType of the document. In this way it reads the right row in the SAP B1 table and in this way I can read all the fields of this row (also the languageID of the actual document).
    Regards
        Emanuele
    Edited by: Emanuele Croci on Dec 3, 2010 9:03 AM

  • Error while passing date parameters in procedure and commit issue

    Hi
    1) I am doing a archiveing records and pls find my code below and i have couple of issue,pls find my code and want to ensure the commit is happening every 100000 rows inserted but i am archeiving a huge table but when i checks the table frequently it shows 0 records and after it shows count the actual rows around 20 million records.How can i ensure it commiting on every 100000 records. pls find my code my db version is 10g on windows
    CREATE OR REPLACE PROCEDURE doins as
    cnt number:=0;
    FOR x IN (select * from Call_log
    where trunc(c_date) = to_date('11-Aug-2008','DD-MON-YYYY'))
    LOOP
    INSERT INTO call_arch
    select * from Call_log
    where trunc(c_date) = to_date('11-Aug-2008','DD-MON-YYYY');
    cnt := cnt + 1;
    IF( cnt = 10000 )
    THEN
    cnt := 0;
    commit;
    END IF;
    commit;
    END LOOP;
    2) Error while passing date as parameter i am getting following errors while passing date parameter pls find my code and errors
    CREATE OR REPLACE PROCEDURE doins(p_date date) as
    cnt number:=0;
    begin
    FOR x IN (select * from Call_log
    where trunc(c_date) = to_char(p_date,'DD-MON-YYYY'))
    LOOP
    INSERT INTO call_arch
    select * from Call_log
    where trunc(c_date) = to_char(p_date,'DD-MON-YYYY');
    cnt := cnt + 1;
    IF( cnt = 10000 )
    THEN
    cnt := 0;
    commit;
    END IF;
    commit;
    END LOOP;
    end;
    exec doins(11-Aug-2008) then gives
    SQL> exec doins(11-Aug-2008);
    BEGIN doins(11-Aug-2008); END;
    ERROR at line 1:
    ORA-06550: line 1, column 16:
    PLS-00201: identifier 'AUG' must be declared
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    if i gave exec doins(11-08-2008) it gaves
    ERROR at line 1:
    ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'DOINS'
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    rgds
    rosh

    CREATE OR REPLACE PROCEDURE doins(p_date varchar2) as
    cnt number:=0;
    begin
    FOR x IN (select A.rowid,A.* from Call_log A
    where trunc(c_date) = to_date(p_date,'DD-MON-YYYY'))
    --hope that's c_date columne is   DATE datatype
    LOOP
    INSERT INTO call_arch
    select * from Call_log
    where rowid=x.rowid;
    cnt := cnt + 1;
    IF( cnt = 10000 )
    THEN
    cnt := 0;
    commit;
    END IF;
    commit;
    END LOOP;
    end;
    thats your correct procedure - but NOT CORRECT ISSUE.
    You should use bulk collect with limit clause and forall clause to do it faster!!! Or Merge clause.

  • Size limitation that can be passed to Java stored procedure

    Hello!
    I enjoy using Oracle8i these days. But I have some questions
    about Java stored procedure. I want to pass the XML data to Java
    stored procedure as IN parameter. But I got some errors when the
    data size is long. Is there any limitation in the data size that
    can be passed to Java stored procedure?
    Would you please help me ?
    This message is long, but would you please read my message?
    Contents
    1. Outline : I write what I want to do and the error message I
    got
    2. About the data size boundary: I write about the boundary
    size. I found that it depend on which calling sequence I use.
    3. The source code of the Java stored procedure
    4. The source code of the Java code that call the Java stored
    procedure
    5. The call spec
    6. Environment
    1.Outline
    I want to pass the XML data to Java stored procedure. But I got
    some errors when the data size is long. The error message I got
    is below.
    [ Error messages and stack trace ]
    java.sql.SQLException: ORA-01460: unimplemented or unreasonable
    conversion reque
    sted
    java.sql.SQLException: ORA-01460: unimplemented or unreasonable
    conversion reque
    sted
    at oracle.jdbc.ttc7.TTIoer.processError(Compiled Code)
    at oracle.jdbc.ttc7.Oall7.receive(Compiled Code)
    at oracle.jdbc.ttc7.TTC7Protocol.doOall7(Compiled Code)
    at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch
    (TTC7Protocol.java:721
    at oracle.jdbc.driver.OracleStatement.doExecuteOther
    (Compiled Code)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithBatch
    (Compiled Code)
    at oracle.jdbc.driver.OracleStatement.doExecute(Compiled
    Code)
    at
    oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(Compiled
    Code
    at
    oracle.jdbc.driver.OraclePreparedStatement.executeUpdate
    (OraclePrepar
    edStatement.java:256)
    at oracle.jdbc.driver.OraclePreparedStatement.execute
    (OraclePreparedStat
    ement.java:273)
    at javaSp.javaSpTestMain.sample_test
    (javaSpTestMain.java:37)
    at javaSp.javaSpTestMain.main(javaSpTestMain.java:72)
    2. About the data size boundary
    I don|ft know the boundary that I got errors exactly, but I
    found that the boundary will be changed if I use |gprepareCall("
    CALL insertData(?)");|h or |gprepareCall ("begin insertData
    (?); end ;")|h.
    When I use |gprepareCall(" CALL insertData(?)".
    The data size 3931 byte ---&#61664; No Error
    The data size 4045 byte ---&#61664; Error
    Whne I use prepareCall ("begin insertData(?); end ;")
    The data size 32612 byte --&#61664;No Error
    The data size 32692 byte ---&#61664; Error
    3. The source code of the Java stored procedure
    public class javaSpBytesSample {
    public javaSpBytesSample() {
    public static int insertData( byte[] xmlDataBytes ) throws
    SQLException{
    int oraCode =0;
    String xmlData = new String(xmlDataBytes);
    try{
    Connection l_connection; //Database Connection Object
    //parse XML Data
    dits_parser dp = new dits_parser(xmlData);
    //Get data num
    int datanum = dp.getElementNum("name");
    //insesrt the data
    PreparedStatement l_stmt;
    for( int i = 0; i < datanum; i++ ){
    l_stmt = l_connection.prepareStatement("INSERT INTO test
    " +
    "(LPID, NAME, SEX) " +
    "values(?, ?, ?)");
    l_stmt.setString(1,"LIPD_null");
    l_stmt.setString(2,dp.getElemntValueByTagName("name",i));
    l_stmt.setString(3,dp.getElemntValueByTagName("sex",i));
    l_stmt.execute();
    l_stmt.close(); //Close the Statement
    l_stmt = l_connection.prepareStatement("COMMIT"); //
    Commit the changes
    l_stmt.execute();
    l_stmt.close(); //Close the Statement l_stmt.execute
    (); // Execute the Statement
    catch(SQLException e ){
    System.out.println(e.toString());
    return(e.getErrorCode());
    return(oraCode);
    4. The source code of the Java code that call the Java stored
    procedure
    public static void sample_test(int num) {
    //make data
    Patient p = new Patient();
    byte[] xmlData = p.generateXMLData(num);
    try{
    // Load the Oracle JDBC driver
    DriverManager.registerDriver(new
    oracle.jdbc.driver.OracleDriver());
    Connection m_connection = DriverManager.getConnection
    ("jdbc:oracle:thin:@max:1521:test",
    "testuser", "testuser");
    CallableStatement l_stmt =
    // m_connection.prepareCall(" CALL insertData(?)");
    m_connection.prepareCall("begin insertData(?); end
    l_stmt.setBytes(1,xmlData);
    l_stmt.execute();
    l_stmt.close();
    System.out.println("SUCCESS to insert data");
    catch(SQLException e ){
    System.out.println( e.toString());
    e.printStackTrace();
    5. The call spec
    CREATE OR REPLACE PROCEDURE insertData( xmlData IN LONG RAW)
    AS
    LANGUAGE JAVA NAME 'javaSp.javaSpBytesSample.insertData(byte[])';
    6. Environment
    OS: Windows NT 4.0 SP3
    RDBMS: Oracle 8i Enterprise Edition Release 8.1.5.0.0 for
    Windows NT
    JDBC Driver: Oracle JDBC Drivers 8.1.5.0.0.
    JVM: Java1.1.6_Borland ( The test program that call Java stored
    procedure run on this Java VM)
    null

    Iam passing an array of objects from Java to the C
    file. The total size of data that Iam sending is
    around 1GB. I have to load this data into the Shared
    memory after getting it in my C file. Iam working on
    HP-UX (64-bit). Everything works fine for around 400MB
    of data. When I try to send around 500MB of data, the
    disk utilization becomes 100%, so does my memory
    utilization and I get a "Not enough space" when I try
    to access shared memory. I have allocated nearly 2.5GB
    in my SHMMAX variable. Also, I have around 45GB of
    disk free. The JVM heap size is also at 2048MB. Where did you get the 400/500 number from? Is that the size of the file?
    What do you do with the data? Are you doing nothing but copying it byte for byte into shared memory?
    If yes then a simple test is to write a C application that does the same thing. If it has problems then it means you have an environment problem.
    If no then you are probably increasing the size of the data by creating a structure to hold it. How much overhead does that add to the size of the data?

  • How to pass a parameter into execute sql task and later use it into dataflow task?

    i am in a situation, where i have a logging table in which i have a primary key called ETL_log_ID which is an identity column and acts as a foreign key for various fact table and dimension tables which are populated using SSIS packages. Now i wanna use the
    ETL_log_ID as a parameter in the execute sql task which populates the log table and pass the same value in the data flow task which populates the facts and dimension. Can you let me know how to pass the parameter in a step by step procedure.
    Thanks,
    Nikhil
      

    Nikhil,
    You can check the following :
    http://www.programmersedge.com/post/2013/03/05/ssis-execute-sql-task-mapping-parameters-and-result-sets.aspx
    http://stackoverflow.com/questions/7610491/how-to-pass-variable-as-a-parameter-in-execute-sql-task-ssis
    Regarding the usage in Dataflow task, Can you elaborate on that a little?
    Thanks,
    Jay
    <If the post was helpful mark as 'Helpful' and if the post answered your query, mark as 'Answered'>

Maybe you are looking for

  • I'm Scared! Syncing Applications, HELP!

    I have never synced my apps on my 3GS, so when I backed it up and I restored it to my new iPhone 4, I lost all my apps. So for the last 4 hours I have gone through itunes and reinstalled my apps to the new iPhone. I want to sync my new phone but when

  • Soldiers in question about macbook air

    ok my friend bought a macbook air. Well we found out that we only have dail up at our new "home". Do they make and usb adpater for the dial up or is it a no go? Thank u

  • List of PO order and GR quantity

    Hi, Can ME2M display the GR quantity because i only can see the order quantity or is there any report can show GR and order quantity? Thank.

  • Error at Copy Form Setting

    Hi All, I've got error message when make copy form setting to user. " You can not continue copying from setting, user add-ons currently connected to SAP Business One Exist. Make sure that selected users and add-ons are logged off and try again" Why t

  • No tables in header/footers- that *****

    Can you no longer have tables in the headers/footers?  If this is the case- so much for all the templates previously created for work- where the image/logo could be put in the header and repeated on all pages.  What a load of crap.