Procedure Parameters Help rquired

Hi all,
I have two tables following. I want to create a procedure with two paramters that If a user give input "S" it goes to SAM table and if user give input "A" it goes to ACCT table and select the following satatement
In case of "S"
select * from sam where sam_frequency in ('DAILY',MONTHLY').In case of "A"
select * from acct where acct_frequency in ('DAILY','MONTHLY','QUARTERLY','HALF YEARLY','YEARLY')
SQL> desc sam
Name                                      Null?    Type
SAM_BANK_ID                                        VARCHAR2(255)
SAM_CUST_ID                                        NUMBER(22)
SAM_SAM_ID                                         VARCHAR2(255)
SAM_PORT_NAME                                      VARCHAR2(255)
SAM_CCY                                            VARCHAR2(255)
SAM_INDICATOR                                      NUMBER(38)
SAM_MANAGED_ACCOUNT                                VARCHAR2(255)
SAM_CLOSED_DATE                                    DATE
SAM_INVESTMENT_PGM                                 VARCHAR2(255)
SAM_ACC_OFF                                        NUMBER(38)
SAM_FREQUENCY                                      VARCHAR2(255)
SQL> desc acct
Name                                      Null?    Type
AC_BANK_ID                                         NUMBER(38)
AC_ACCT_ID                                         VARCHAR2(255)
AC_CUST_ID                                         NUMBER(38)
AC_CCY                                             VARCHAR2(255)
AC_CATEGORY                                        VARCHAR2(255)
AC_ACCOUNT_OFFICER                                 NUMBER(38)
AC_OTHER_OFFICER                                   NUMBER(38)
AC_SHORT_NAME                                      VARCHAR2(255)
AC_INACTIVE_MARKER                                 VARCHAR2(7)
AC_LOCAL_A1                                        VARCHAR2(255)
AC_LOCAL_A2                                        VARCHAR2(255)
AC_LOCAL_A3                                        VARCHAR2(255)
AC_LOCAL_N1                                        NUMBER
AC_LOCAL_N2                                        NUMBER
AC_LOCAL_N3                                        NUMBER
ACT_STMNT_FRQ                                      VARCHAR2(20)
OPENING_DATE                                       DATE
CLOSURE_DATE                                       DATE
STATUS                                             VARCHAR2(20)please tell me how can i achieve the followin result while S and A vaules are not in table structures.
Regards
null

create or replace procedure myProc ( v_parameter in char, v_cursor out sys_refcursor )
is
v_sql varchar2(1000);
begin
     if v_parameter = 'S' then
     v_sql := 'select * from sam where sam_frequency in (''DAILY'',''MONTHLY'')';
     elsif v_parameter = 'A' then
     v_sql := 'select * from acct where acct_frequency in (''DAILY'',''MONTHLY'',''QUARTERLY'',''HALF YEARLY'',''YEARLY'')';
     end if;     
     open v_cursor for v_sql;
end;
I think, code that you ask is above...
null

Similar Messages

  • Unused stored procedure parameters marked with a check mark in crystal reports

    Post Author: epowers0213
    CA Forum: General
    Hello,
    I have some Crystal Reports that currently use stored procedures as their datasources (I am in the process of modifying them to use datasets instead).  Some of the original reports have check marks next to stored procedure parameters which I cannot find as being used anywhere in the report.  Is this a legitimate possibility? (Some of them do not have check marks, however, so it is not consistent.)
    More Info:  I am using Crystal Reports within Visual Studio 2005.  I have looked through each report in every way I can think of to find if a parameter field is being used anywhere - I have checked all formula fields, the formatting formulas for sections and individual fields, the record and group selection formulas and the grouping and sorting experts, along with any subreports (although some of them have no subreports).
    (I have read on other forums that exporting a report definition file is another way to look for where fields or parameters are being used, but this does not appear possible within Visual Studio 2005.)
    In some cases, I have gone ahead and replaced the stored procedure datasource location with a dataset (generated based on the same stored procedure).  When I do this, Crystal automatically deletes the stored procedure parameters from the report, and I have still been able to run the modified report successfully - at least it looks ok and nothing is complaining.  So is it possible that these parameters were actually not being used anywhere on the report although they were marked with a check mark?
    Any help would be greatly appreciated!  I want to make sure I am not changing the function of these reports somehow without knowing it...
    Thank you!

    Are you referencing another database that Crystal can't see? Also, you can try and copy the SQL to a command object in Crystal to see if it behaves differently there.

  • We are not able to execute below procedure, plz help me ASAP.

    Dear All
    I am created one procedure with 4 parameter 1 is Ref Cusrsor rest of 3 are Varchar,But we are not able to execute below procedure, plz help me ASAP.
    CREATE OR REPLACE PROCEDURE GETCHART(RPT_CURSOR OUT RPT_PACKAGE.RPT_RESULTS,
    V_VITALCHARTING VARCHAR2,
    V_DOCIDPATIENTS VARCHAR2,
    v_fromdate varchar2,
    v_todate varchar2) AS
    D1 VARCHAR2(500);
    D2 VARCHAR2(500);
    G1 VARCHAR2(500);
    R1 VARCHAR2(500);
    R2 VARCHAR2(500);
    R3 VARCHAR2(500);
    R4 VARCHAR2(500);
    R5 VARCHAR2(500);
    H1 VARCHAR2(500);
    H2 VARCHAR2(500);
    V_COUNT NUMBER;
    RC VARCHAR2(100);
    RMI VARCHAR2(100);
    RMAX VARCHAR2(100);
    R12 VARCHAR2(500);
    REQ NUMBER;
    V_MAX number;
    v_idcount number;
    RSEQ NUMBER;
    RCH VARCHAR2(500);
    BEGIN
    INSERT INTO TEMPDATA
    SELECT ROWNUM G, TIME1
    FROM (SELECT distinct TO_CHAR(H.RECORDEDDNT, 'mm/dd/yy hh24:mi:ss') TIME1
    FROM VIEW_PATIENTCHART V,
    chartingtxheader H,
    chartingtxdetails D
    WHERE h.docid = d.docidchartingtxheader
    and v.VITALCHARTING_PK = h.docidvitalcharting
    and v.VITALPARAMETER_PK = d.docidvitalparameter
    and v.VITALCHARTING_PK = V_VITALCHARTING --General Vital Signs
    and H.DOCIDPATIENTS = V_DOCIDPATIENTS
    and TO_DATE(to_char(h.recordeddnt, 'DD/MM/YYYY'),
    'DD/MM/YYYY') BETWEEN
    TO_DATE(v_fromdate, 'DD/MM/YYYY') AND
    TO_DATE(V_TODATE, 'DD/MM/YYYY'));
    SELECT MAX(ID) INTO V_MAX FROM TEMPDATA;
    V_IDCOUNT := 0;
    WHILE V_IDCOUNT < V_MAX loop
    FOR J IN (SELECT id, ROWNUM G, vdate time1
    FROM (SELECT id, ROWNUM, VDATE
    FROM TEMPDATA
    WHERE ID BETWEEN V_IDCOUNT + 1 AND V_IDCOUNT + 8)) LOOP
    D1 := D1 || 'COL' || J.G || ',';
    D2 := D2 || '''' || J.TIME1 || '''' || ',';
    END LOOP;
    D1 := SUBSTR(D1, 1, LENGTH(D1) - 1);
    D2 := SUBSTR(D2, 1, LENGTH(D2) - 1);
    DBMS_OUTPUT.PUT_LINE(d1);
    SELECT SEQ_GETCHART.NEXTVAL INTO RSEQ FROM DUAL;
    G1 := 'INSERT INTO GETDATA2 (IDSLNO,idcount,' || D1 || ') VALUES(' || RSEQ || ',' ||
    V_IDCOUNT || ',' || D2 || ')';
    --EXECUTE IMMEDIATE G1;
    DBMS_OUTPUT.PUT_LINE(d1);
    DBMS_OUTPUT.PUT_LINE(SUBSTR(D2, 1, LENGTH(D2) - 1));
    DBMS_OUTPUT.PUT_LINE(G1);
    EXECUTE IMMEDIATE G1;
    FOR K IN (SELECT id, ROWNUM G, vdate time2
    FROM (SELECT id, ROWNUM, VDATE
    FROM TEMPDATA
    WHERE ID BETWEEN V_IDCOUNT + 1 AND V_IDCOUNT + 8)) LOOP
    FOR I IN (select s.*, rownum hslno
    from (SELECT v.CHARTNAME,
    v.PARAMETERNAME_CS,
    ' ' || v.PARAMETERNAME PARAMETERNAME,
    TO_CHAR(H.recordeddnt, 'mm/dd/yy hh24:mi:ss') TIME1,
    CASE
    WHEN IDSLNO_GN5029 IN (1040, 1041) THEN
    CASE
    WHEN TO_NUMBER(d.recordedvalue) <
    TO_NUMBER(D.MINVALUE) THEN
    decode(d.recordedvalue,
    null,
    d.recordedvalue,
    d.recordedvalue || ' ' || 'L')
    ELSE
    CASE
    WHEN TO_NUMBER(d.recordedvalue) >
    TO_NUMBER(D.MaxVALUE) THEN
    decode(d.recordedvalue,
    null,
    d.recordedvalue,
    d.recordedvalue || ' ' || 'H')
    ELSE
    decode(d.recordedvalue,
    null,
    d.recordedvalue,
    d.recordedvalue || ' ' || 'N')
    END END ELSE d.recordedvalue END IMAGECHAR,
    d.minvalue,
    d.maxvalue,
    D.UOMCODE
    FROM VIEW_PATIENTCHART V,
    chartingtxheader H,
    chartingtxdetails D
    WHERE h.docid = d.docidchartingtxheader
    and v.VITALCHARTING_PK = h.docidvitalcharting
    and v.VITALPARAMETER_PK = d.docidvitalparameter
    and v.VITALCHARTING_PK = V_VITALCHARTING --General Vital Signs
    and H.DOCIDPATIENTS = V_DOCIDPATIENTS
    ORDER BY V.DISPLAYORDER_CS, V.DISPLAYORDER
    -- v.PARAMETERNAME_CS,v.PARAMETERNAME
    ) s
    where s.time1 = k.time2) LOOP
    select count(1)
    into v_count
    from GETDATA2 d
    where d.PARAMETERNAME_CS = i.PARAMETERNAME_CS
    and PARAMETERNAME = i.PARAMETERNAME
    and idcount = v_idcount;
    IF V_COUNT = 0 THEN
    RCH := I.CHARTNAME;
    R1 := 'COL' || K.G;
    R2 := '''' || I.PARAMETERNAME_CS || '''' || ',';
    R3 := '''' || I.PARAMETERNAME || '''' || ',';
    R4 := '''' || I.IMAGECHAR || '''';
    RC := '''' || I.CHARTNAME || '''' || ',';
    RMI := '''' || I.minvalue || '''' || ',';
    RMAX := '''' || I.maxvalue || '''' || ',';
    R12 := '''' || I.UOMCODE || '''' || ',';
    SELECT SEQ_GETCHART.NEXTVAL INTO RSEQ FROM DUAL;
    H1 := 'INSERT INTO GETDATA2 (IDSLNO,UMCODE,idcount,CHARTNAME,minvalue,maxvalue,PARAMETERNAME_CS,PARAMETERNAME,' || R1 || ')' ||
    ' values(' || RSEQ || ',' || R12 || v_idcount || ',' || RC || RMI || RMAX || R2 || R3 || R4 || ')';
    EXECUTE IMMEDIATE H1;
    ELSE
    R5 := 'COL' || K.G;
    R4 := '''' || I.IMAGECHAR || '''';
    H2 := 'UPDATE GETDATA2 SET ' || R5 || '=' || R4 ||
    'WHERE PARAMETERNAME_CS=' || '''' || I.PARAMETERNAME_CS || '''' ||
    ' AND ' || 'PARAMETERNAME=' || '''' || I.PARAMETERNAME || '''';
    EXECUTE IMMEDIATE H2;
    END IF;
    END LOOP;
    end loop;
    UPDATE getdata2 s
    set s.parametername = s.parametername || ' -' || ' (' || minvalue ||
    ' -- ' || maxvalue || ') ' || UMCODE
    where s.parametername is not null
    and idcount = v_idcount
    and minvalue != 0
    and maxvalue != 0;
    UPDATE getdata2 s
    set s.parametername = s.parametername || ' -' || UMCODE
    where s.parametername is not null
    and idcount = v_idcount
    and minvalue = 0
    and maxvalue = 0;
    UPDATE GETDATA2 S
    SET S.PARAMETERNAME_CS = NULL
    WHERE ROWID NOT IN (SELECT MIN(ROWID)
    FROM GETDATA2
    WHERE idcount = v_idcount
    GROUP BY PARAMETERNAME_CS)
    and idcount = v_idcount;
    UPDATE GETDATA2 S
    SET CHARTNAME = NULL
    WHERE ROWID NOT IN (SELECT MIN(ROWID)
    FROM GETDATA2
    WHERE idcount = v_idcount
    GROUP BY CHARTNAME)
    and idcount = v_idcount;
    UPDATE getdata2 s
    set s.parametername = ' PARAMETER'
    where s.parametername is null
    AND S.PARAMETERNAME_CS IS NULL;
    v_idcount := v_idcount + 8;
    D1 := null;
    d2 := null;
    end loop;
    for i in (SELECT G.PARAMETERNAME_CS, G.IDSLNO
    FROM GETDATA2 G
    WHERE G.PARAMETERNAME_CS IS NOT NULL) LOOP
    INSERT INTO GETDATA2
    (IDSLNO, PARAMETERNAME)
    VALUES
    (I.IDSLNO - 1 + 0.5, I.PARAMETERNAME_CS);
    END LOOP;
    update GETDATA2 h set h.PARAMETERNAME_CS = null;
    update GETDATA2 h set h.chartname = rcH;
    INSERT INTO GETDATA1
    SELECT CHARTNAME,
    PARAMETERNAME_CS,
    PARAMETERNAME,
    COL1,
    COL2,
    COL3,
    COL4,
    COL5,
    COL6,
    COL7,
    COL8,
    COL9,
    COL10,
    MINVALUE,
    MAXVALUE,
    UMCODE
    FROM GETDATA2
    ORDER BY IDSLNO;
    OPEN RPT_CURSOR FOR
    SELECT * FROM GETDATA1;
    END;
    CREATE OR REPLACE PACKAGE "RPT_PACKAGE"
    as
    type RPT_RESULTS is REF CURSOR;
    type RPT_VARRAY is VARRAY(2000) of VARCHAR2(2000);
    END RPT_PACKAGE;
    Execute
    declare
    type my_newcursor IS REF CURSOR;
    begin
    GETCHART(my_newcursor,'General Vital Sign','1145561',sysdate-1,sysdate);
    end;

    Parwez wrote:
    Dear All
    I am created one procedure with 4 parameter 1 is Ref Cusrsor rest of 3 are Varchar,But we are not able to execute below procedure, plz help me ASAP.
    see a picture of my car.
    my car won't go.
    tell me how to make my car go.
    How do I ask a question on the forums?
    SQL and PL/SQL FAQ

  • ORA-30626: function/procedure parameters of remote object types not support

    Hello,
    I am trying to create a dynamic LOV.
    I have a table and package in a remote database, I am connecting to the database using dblink. When I access package I am getting error
    ORA-30626: function/procedure parameters of remote object types are not supported
    However I can access table with [email protected], not the package!
    How can I solve this problem?

    Did you ever get an answer/workaround to this? I'm having similar problems in 10g.

  • Is It Possible To define a size of the Procedure Parametere?

    In Oracle Is It Possible To define a size of the Procedure Parametere?
    If i have the procedure like
    Test_sp(no int,name varchar2)
    Is it possible to define a size
    Test_sp(no int(5),name varchar2(255))
    Thanks
    Rangan S

    As Anthony said - no, not in the parameter signature of a procedure or a function. Which could have unexpected run-time errors as one could wrongly assume that using a "derived" type will allow this.
    The following example illustrates:
    SQL> create table datatype(
    2 varchar2_5 varchar2(5),
    3 number1 number(1)
    4 );
    Table created.
    SQL>
    SQL>
    SQL> create or replace procedure fooProc( s datatype.varchar2_5%TYPE, n datatype.number1%TYPE ) is
    2 s1 datatype.varchar2_5%TYPE;
    3 n1 datatype.number1%TYPE;
    4 begin
    5 begin
    6 DBMS_OUTPUT.put_line( 'len='||length(s)||' value='||s );
    7 DBMS_OUTPUT.put_line( 'value='||to_char(n) );
    8 exception when OTHERS then
    9 DBMS_OUTPUT.put_line( 'parameter display failed with error '||SQLERRM(SQLCODE) );
    10 end;
    11
    12 begin
    13 s1 := s;
    14 DBMS_OUTPUT.put_line( 'string parameter assignment succeeded' );
    15 exception when OTHERS then
    16 DBMS_OUTPUT.put_line( 'string assignment failed with error '||SQLERRM(SQLCODE) );
    17 end;
    18
    19 begin
    20 n1 := n;
    21 DBMS_OUTPUT.put_line( 'number parameter assignment succeeded' );
    22 exception when OTHERS then
    23 DBMS_OUTPUT.put_line( 'number assighment failed with error '||SQLERRM(SQLCODE) );
    24 end;
    25 end;
    26 /
    Procedure created.
    SQL>
    SQL> exec fooProc( 'test1', 1 );
    len=5 value=test1
    value=1
    string parameter assignment succeeded
    number parameter assignment succeeded
    PL/SQL procedure successfully completed.
    SQL>
    SQL> exec fooProc( 'this should fail', 1 );
    len=16 value=this should fail
    value=1
    string assignment failed with error ORA-06502: PL/SQL: numeric or value error: character string buffer too small
    number parameter assignment succeeded
    PL/SQL procedure successfully completed.
    SQL>
    SQL> exec fooProc( 'test', 1234 );
    len=4 value=test
    value=1234
    string parameter assignment succeeded
    number parameter assignment succeeded
    PL/SQL procedure successfully completed.
    SQL>
    Note that only the string assignment fails. The string parameter works fine. And there is no impact at all on the number side, despite seemingly constraining it to a single digit.

  • How to set store procedure parameters

    Hello,
    To summarize our problem, we are not able to set store procedure parameters using JRC and without using a Viewer.
    Inside an rpt document we use a call to a store procedure that requires some input parameters.
    We attempted to pass the required parameters to the report (please see below) but it seems that those parameters are somehow ignored.
    In fact null values are always received by the store procedure.
    For your information, if the document doesnu2019t contain a call to a store proc but SQL clause parameters instead, then that works.
    Does that mean that sp parameters have to be set in a specific way?
    Please can you advise?
    Tanks a lot,
    Joseph
    This is how we set parameter values:
    private void handleParameters(ReportClientDocument pm_document, List pm_parameters) throws Exception
         ParameterFieldController pfc = pm_document.getDataDefController().getParameterFieldController();
         pfc.setCurrentValue(reportName, parameterFieldName, parameterValue);
    Then we export in a pdf file:
    private InputStream createInputStream(ReportClientDocument pm_document, String pm_reportName) throws Exception
         return (ByteArrayInputStream)pm_document.getPrintOutputController().export(ReportExportFormat.PDF);

    First question:
    Do you set the parameters before the database logon?
    Sincerely,
    Ted Ueda

  • How to create an External Content Type with SQL Stored Procedures Parameters and query it in a SharePoint App

    Hi,
    I'm new to SharePoint 2013 I want to be able to query a MSSQL database from a SharePoint App I have tried to create an External Content Type (ECT) which is produced from a MSSQL stored Procedure, this procedure has several parameters which are needed to
    filter the data correctly.  From here I want to produce an external list which I can then query from a c# SharePoint app.  If I leave the filters in the ECT null then the list is of course empty or if enter a default values the results are limited
    for the app to query so are no good.
    I want to dynamically pass values to the ECT when querying from the app, is this not possible.  Should I just be returning everything in an external list and then letting the query in the app filter the data, this seems inefficient?
    Is this the best way to do this or should I be doing this differently?
    Please can someone point me in the right direction.
    Thanks

    Hi Pandra801,
    When you create a the external content type, please try to add a filter based on your select statement.
    http://arsalkhatri.wordpress.com/2012/01/07/external-list-with-bcs-search-filters-finders/
    Or, try to create a stored procedure based on your select statement, then create ECT using the SQL stored procedure.
    A step by step guide in designing BCS entities by using a SQL stored procedure
    http://blogs.msdn.com/b/sharepointdev/archive/2011/02/10/173-a-step-by-step-guide-in-designing-bcs-entities-by-using-a-sql-stored-procedure.aspx
    I hope this helps.
    Thanks,
    Wendy
    Wendy Li
    TechNet Community Support

  • To get the the out put of the procedure..help needed

    hi all,
    i have a procedure :
    CREATE OR REPLACE PROCEDURE EN_GetCategory
         StaffID IN      VARCHAR2 DEFAULT NULL,
         ResultCategory OUT      VARCHAR2
    AS
    v_exec_tx varchar2(2000);
         Condition VARCHAR2(1000);
         Category VARCHAR2(1);
         SQL_ADV VARCHAR2(2000);
         Cnt          NUMBER(10);
         Cnt1          NUMBER(10);
    CURSOR curCategory IS
    SELECT SMC.Category,SMC.Condition FROM ST_MS_Category SMC ORDER BY OrderRowNo;
         BEGIN
              EXECUTE IMMEDIATE 'TRUNCATE TABLE TMP';
              OPEN curCategory;
              FETCH curCategory INTO Category, Condition;
              while curCategory%FOUND
              LOOP
              BEGIN
                   v_exec_tx:='SELECT COUNT(*) FROM ST_EMPLOYEE WHERE StaffID=''' || EN_GETCATEGORY.STAFFID ||''' AND ' || EN_GETCATEGORY.CONDITION;
                   EXECUTE IMMEDIATE v_exec_tx into Cnt;
    IF Cnt > 0 THEN                              SELECT COUNT(*) INTO CNT1 FROM tmp ;
              IF CNT1> 0     THEN
                                       UPDATE tmp SET CAT = Category ;
              ELSE
                                       INSERT INTO tmp VALUES (Category );
              END IF;
              END IF;
              FETCH curCategory INTO Category, Condition;
                   END;
              END LOOP;
              CLOSE curCategory;
              BEGIN
                   FOR REC IN ( SELECT CAT FROM tmp
                   LOOP
                   EN_GetCategory.ResultCategory := REC.CAT;
                   END LOOP;
              END;
         END;
    i need to execute this procedure..
    i tried EXEC EN_GETCATEGORY('812005','');
    but getting error invalid sql statemnt..
    i think for this we have to write some more code can u please help to to find the output ofthis procedure..
    Thanks In advance

    Hi,
    i tried EXEC EN_GETCATEGORY('812005','');It's execute Procedure_name('Parameters');
    Regds.What tosh! "exec" is perfectly ok to use to call a procedure.
    The problem is with the OUT parameter. You need to declare a variable into which the OUT value can be put.

  • PL/SQL Procedure Parameters PROBLEM

    Here's my problem:
    When we describe the successfully compiled PL/SQL packaged procedures in SQL*Plus, the parameter order seems reversed. For instance, my PL/SQL source looks like this:
    Create Package pkg1...
    Procedure func1 (param1 in varchar2,
    param2 in number) is
    ...function body...
    end func1;
    end pkg1;
    After it is successfully compiled in SQL*Plus, when I describe it using the desc command, it shows:
    PROCEDURE FUNC1
    Argument Name Type ......
    PARAM2 VARCHAR2
    PARAM1 VARCHAF2
    This problem occurs occasionally, if we recompile the source, it goes away. We couldn't quite tell when and how this happens. When the problem occurs, we checked the ALL_SOURCE view and verified that the parameters are in the right order.
    We use the Merant Drivers for our client side interfaces and whenever we have this problem on the db server, we get the "wrong number of types or parameters" error.
    Any clues, hints, solutions are greatly appreciated.
    Thank you for your time.
    On a different note, I couldn't find the appropriate forum to post this PL/SQL specific message, wondering why there isn't a PL/SQL forum.
    Murthy.

    Hi Yegneshwar
    Can U tell me how to invoke the procedure ? If all it can be invoked the post it or mail me and then I might help U out.
    Thank U.
    edwin

  • Sys_refcursor procedure parameters in out

    Hi,
    I have created a procedure that receive the SQL statment in VARCHAR" datatype parameters and return the Resultset into a refcursor :
    create or replace
    procedure my_test(VAL1 in number, val2 in number, val3 in number, val4 in VARCHAR2, vla5 out nocopy SYS_REFCURSOR )
    is
    begin
      open vla5 for 'select * FROM (select x_x.*  ,rownum rn  FROM ('||val4 ||') x_x where rownum <= '|| to_char(val3)||' ) where rn >='|| to_char(val2);
    end;I like to pass and receive the val4 and val5 in one parameters :
    procedure my_test(VAL1 in number, val2 in number, val3 in number, val4 in out nocopy SYS_REFCURSOR )I like to pass the SQL statment in VARCHAR2 datatype to my procedure and return the result in the same variable parameters.
    I don't know if my english was understand, but could you please help me to find a solution?
    thanks a lot.
    Calà Salvatore

    Can we have more detail please?
    A sys_refcursor is not a SQL statement that you can add predicates to. So not possible to combine the two arguments. Not at all.
    To receive a refcursor and try to do it doesn't make sense.
    See Refcursor 101 thread:
    PL/SQL 101 : Understanding Ref Cursors
    If you want to receive a SQL statement as a VARCHAR2/CLOB/LONG and you want to wrap it with further predicates then you can do that just with string manipulation - as you're doing.
    However, if you do receive a sql statement as a string and want to wrap it with a select and further predicates, you should use binds for the predicate values not string concatenation of literals which is likely to be poorly performant and a possible security issue (also see DBMS_ASSERT).
    Edited by: DomBrooks on Nov 9, 2010 11:00 AM

  • [ORACLE] Retrieve procedure parameters name via DatabaseMetadata

    I'm trying to use the OracleCachedRowSet in orcs12.jar to retrieve the parameters name of a specified procedure.
    DatabaseMetaData dbmd = con.getMetaData();
    ResultSet metaColumns = dbmd.getProcedureColumns(catalog,null,namePattern,"%");
    The big problem is that if I retrieve the information for a function I found in the resultset all the paramets correctly, instead if I try with a procedure the first parameter is missed why ???
    Example:
    procedure ins(
    name in varchar2,
    surname in varchar2,
    id out number
    The returned resultset cotain only surname and id parameters and not the first name parameter.
    function ins(
    name in varchar2,
    surname in varchar2,
    ) return number;
    The returned resultset cotain name and surname
    Help me !!! :)

    Martha,
    could you tell me what's wrong in my C# in calling stored procedure. Thank you.
    C#:
    private void ProcedureCallEx1()
         OracleConnection oraConn = new OracleConnection();
         oraConn.ConnectionString = "User ID=www_user;Password=xxxxx;Data Source=\"NCTDB.NHTSA\"";                    
         oraConn.Open();
         OracleCommand proCmd;
         try
              proCmd = new OracleCommand();
              proCmd.CommandText = "test_query(p_tstno, p_filename)"; //www_user. "ODPNet.getProductsInfo";
              proCmd.CommandType = CommandType.StoredProcedure;
              proCmd.Connection = oraConn;
              OracleParameter param = proCmd.Parameters.Add("p_tstno", OracleDbType.Int32);
              param.Direction = ParameterDirection.Input;
              param.Size=20;
              param.Value = 1234;
              param = proCmd.Parameters.Add("p_filename", OracleDbType.Varchar2);
              param.Direction = ParameterDirection.Output;
              param.Size=20;                    
              proCmd.ExecuteNonQuery();
              oraConn.Close();
         catch(Exception ex)
              Console.WriteLine("{0} Exception caught.", ex);
    }     // ProcedureCallEx1
    Error message when implementing proCmd.ExecuteNonQuery():
    {"ORA-06550: line 1, column 7:\nPLS-00801:
    internal error [22503]\nORA-06550: line 1, column 7:\nPL/SQL: Statement ignored" }
    Stored Procedure:
    PROCEDURE report_query(p_tstno IN NUMBER, p_filename OUT VARCHAR2)
    IS
    BEGIN
    SELECT filename
         INTO p_filename
         FROM vehdb.reports
         WHERE repttstno = p_tstno;
    EXCEPTION
         WHEN NO_DATA_FOUND THEN
         p_filename := 'NO FILENAME';
    END;

  • Guided Procedures - Urgent help please

    Hello,
    Can anybody please help me with the information I am looking for?
    Our issues with EP Guided Procedures (GP) are in two spots:
    1) Parameter Passing - Use of  “out”  and “in” parameters from the process context to return / send values from Web Dynpro is not possible using out-of-box functionality.
    2) Eventing / Wait states/ "eventing" - In GP, when multiple parallel processes come to the final decision point, the automated decision point is processed based on the first process that arrives to the decision point. It is not possible to ‘Hold’ a process until the other parallel processes are complete.
    Which of the following statements is true with respect to the issues we are having?
    a) the product has these capabilities, and we've just not properly taken advantage of them;
    b) the functionality doesn't currently exist - but is planned for near releases;
    c) the functionality doesn't exist - nor is it planned to be delivered by SAP.
    Thank you very much.
    Regards,
    Jagadish

    Hi David,
    Assuming that they are actually blocks in a process (I do not see other possibility of actually handling two different processes instead of two blocks in a process, but I will confirm with the person who brought the issues to my notice), is it possible to specify exit condition for one block that also depends on the exit condition of second block? That means even if the exit condition of one block is met, can it wait for the second block's exit condition?
    In BPM we have Fork step where I can specify parallel branches and design the process such that it runs through certain number of branches. Is anything available like this in GP? Can you please provide any documentation which explains the parallel block handling in GP?  As I mentioned in my other response, I am familiar with BPM, but never used GP.
    Thank you very much.

  • PL/SQL procedure--------------please help----what is it ?? explain brief

    (TO_DATE('&2')-1)
    CREATE OR REPLACE PROCEDURE GAT_SVC_ACTIVITY(REFDATE IN DATE:=SYSDATE-1,
    MSK IN INTEGER:=31)
    AS
    --DECLARE
    V_COUNT NUMBER :=0;
    V_LIMIT NUMBER :=0;
    V_SOURCE_SITE_ID NUMBER :=0;
    V_SOURCE_SITE_ID_N NUMBER := NULL;
    V_CUSSOR INTEGER;
    V_PROCESSED INTEGER;
    V_ERRDESC VARCHAR2(200);
    CURSOR C_TMP_ONSITE IS SELECT
    X.*,
    CLH.DATE_CODE CLH_DATE_CODE,
    CLH.DPS_NBR CLH_DPS_NBR,
    CLH.CASE_NUM CLH_CASE_NUM,
    CLH.FLG_DELLSRV CLH_FLG_DELLSRV,
    2 SVC_ACTIVITY_SRC_ID
    FROM (SELECT
    OS.DPS_NBR,
    OS.ARRIVE_TIMESTAMP,
    OS.COMPL_TIMESTAMP,
    OS.STATUS_CODE,
    OS.PROBLEM_CODE,
    OS.CAUSE_CODE,
    OS.ACTION_CODE,
    JH.DPS_NBR JH_DPS_NBR,
    JH.DPS_TYPE JH_DPS_TYPE,
    NVL2(TRIM(JH.TPM_CODE),TRIM(JH.TPM_CODE),'DELL') JH_TPM_CODE
    FROM (SELECT * FROM TEMP_ONSITE WHERE DPS_NBR IS NOT NULL
    AND ARRIVE_TIMESTAMP IS NOT NULL
    AND COMPL_TIMESTAMP IS NOT NULL
    AND STATUS_CODE IS NOT NULL
    AND STATUS_CODE_DESC IS NOT NULL
    AND PROBLEM_CODE IS NOT NULL
    AND PROBLEM_CODE_DESC IS NOT NULL
    AND CAUSE_CODE IS NOT NULL
    AND CAUSE_CODE_DESC IS NOT NULL
    AND ACTION_CODE IS NOT NULL
    AND ACTION_CODE_DESC IS NOT NULL
    ) OS
    LEFT JOIN JDPS_DBA.JDPS_HEADER JH
    ON OS.DPS_NBR=JH.DPS_NBR
    GROUP BY
    OS.DPS_NBR,
    OS.ARRIVE_TIMESTAMP,
    OS.COMPL_TIMESTAMP,
    OS.STATUS_CODE,
    OS.STATUS_CODE_DESC,
    OS.PROBLEM_CODE,
    OS.PROBLEM_CODE_DESC,
    OS.CAUSE_CODE,
    OS.CAUSE_CODE_DESC,
    OS.ACTION_CODE,
    OS.ACTION_CODE_DESC,
    JH.DPS_NBR,
    JH.DPS_TYPE,
    JH.TPM_CODE
    ) X
    LEFT JOIN GS_CALL_LOG_HEADER CLH
    ON X.DPS_NBR=CLH.DPS_NBR;
    V_TMP_ONSITE C_TMP_ONSITE%ROWTYPE;
    V_TMP_STATUS_FILE C_TMP_STATUS_FILE%ROWTYPE;
    V_TMP_CASE_AUDIT C_TMP_CASE_AUDIT%ROWTYPE;
    V_MER_CASE_HISTORY C_MER_CASE_HISTORY%ROWTYPE;
    V_SVC_STATUS_ID_A SVC_ACTIVITY.SVC_STATUS_ID%TYPE;
    V_SVC_STATUS_ID_C SVC_ACTIVITY.SVC_STATUS_ID%TYPE;
    BEGIN
    SELECT SOURCE_SITE_ID INTO V_SOURCE_SITE_ID FROM SOURCE_SITE;
    DELETE ERR_SVC_ACTIVITY WHERE TO_DATE(ERR_DATE)=TO_DATE(SYSDATE);
    COMMIT;
    IF BITAND(MSK,4)=4 THEN
    UPDATE TABLE_STATUS SET STATUS='WRITING...',UPDATE_DATE=SYSDATE WHERE TABLE_NAME='GS_CASE_HEADER';
    COMMIT;
    V_CUSSOR := DBMS_SQL.OPEN_CURSOR;
    DBMS_SQL.PARSE(V_CUSSOR, 'TRUNCATE TABLE GS_CASE_HEADER', DBMS_SQL.V7);
    V_PROCESSED := DBMS_SQL.EXECUTE(V_CUSSOR);
    DBMS_SQL.CLOSE_CURSOR(V_CUSSOR);
    INSERT INTO GS_CASE_HEADER NOLOGGING (
    CASE_NUM,
    SEVERITY_ID,
    USER_ID
    (SELECT
    CH.CASE_NUM,
    CH.SEVERITY_ID,
    CH.USER_ID
    FROM JDPS_DBA.CASE_HEADER CH
    GROUP BY
    CH.CASE_NUM,
    CH.SEVERITY_ID,
    CH.USER_ID
    COMMIT;
    UPDATE TABLE_STATUS SET STATUS='COMPLETED',UPDATE_DATE=SYSDATE WHERE TABLE_NAME='GS_CASE_HEADER';
    COMMIT;
    END IF;
    -- Gather Data. "SVC_ACTIVITY" 1/4
    -- TEMP_ONSITE ---> SVC_ACTIVITY
    IF BITAND(MSK,1)=1 THEN
    UPDATE TABLE_STATUS SET STATUS='WRITING...',UPDATE_DATE=SYSDATE WHERE TABLE_NAME='SVC_ACTIVITY02';
    COMMIT;
    V_CUSSOR := DBMS_SQL.OPEN_CURSOR;
    DBMS_SQL.PARSE(V_CUSSOR, 'TRUNCATE TABLE SVC_ACTIVITY02', DBMS_SQL.V7);
    V_PROCESSED := DBMS_SQL.EXECUTE(V_CUSSOR);
    DBMS_SQL.CLOSE_CURSOR(V_CUSSOR);
    SELECT STATUS_ID INTO V_SVC_STATUS_ID_A FROM M_STATUS WHERE STATUS_TYPE_ID_DESC='ONSITE' AND STATUS_CODE='ARRIV';
    SELECT STATUS_ID INTO V_SVC_STATUS_ID_C FROM M_STATUS WHERE STATUS_TYPE_ID_DESC='ONSITE' AND STATUS_CODE='COMPL';
    OPEN C_TMP_ONSITE;
    LOOP
    FETCH C_TMP_ONSITE INTO V_TMP_ONSITE;
    EXIT WHEN C_TMP_ONSITE%NOTFOUND;
    SELECT COUNT(*) INTO V_COUNT FROM MT_ONSITE WHERE DPS_NBR=V_TMP_ONSITE.DPS_NBR AND STATUS_DESC='ARRIV' AND TIME_STAMP=V_TMP_ONSITE.ARRIVE_TIMESTAMP;
    IF V_COUNT=0 THEN
    INSERT INTO ERR_SVC_ACTIVITY E (
    E.ACTIVITY_ID,
    E.ACTIVITY_DESC,
    E.ACTIVITY_EFF_DATE,
    E.ACTIVITY_EFF_DTS,
    E.ACTIVITY_END_DATE,
    E.ACTIVITY_END_DTS,
    E.ACTIVITY_REASON_ID,
    E.ACTIVITY_START_DATE,
    E.ACTIVITY_START_DTS,
    E.CASE_ID,
    E.CAUSE_ID,
    E.DELL_PROD_SVC_DESC_ID,
    E.INTERACTION_ID,
    E.SVC_ACTIVITY_SRC_ID,
    E.SVC_EVENT_TYPE_ID,
    E.SVC_INTERACTION_ID,
    E.SVC_PROVIDER_ID,
    E.SVC_RESULT_ID,
    E.SVC_STATUS_ID,
    E.EXTRACT_DATE,
    E.EXTRACT_DTS,
    E.SOURCE_SITE_ID,
    E.LOAD_SEQ_NUM,
    E.ERR_DESC,
    E.ERR_DATE
    VALUES (
    NULL,
    'ARRIV',
    V_TMP_ONSITE.ARRIVE_TIMESTAMP,
    TO_TIMESTAMP(TO_CHAR(V_TMP_ONSITE.ARRIVE_TIMESTAMP,'yyyy-mm-dd hh24:mi:ss')),
    V_TMP_ONSITE.COMPL_TIMESTAMP,
    TO_TIMESTAMP(TO_CHAR(V_TMP_ONSITE.COMPL_TIMESTAMP,'yyyy-mm-dd hh24:mi:ss')),
    NULL,
    V_TMP_ONSITE.ARRIVE_TIMESTAMP,
    TO_TIMESTAMP(TO_CHAR(V_TMP_ONSITE.ARRIVE_TIMESTAMP,'yyyy-mm-dd hh24:mi:ss')),
    NULL,
    NULL,
    NULL,
    NULL,
    V_TMP_ONSITE.SVC_ACTIVITY_SRC_ID,
    NULL,
    NULL,
    NULL,
    NULL,
         NULL,
    SYSDATE,
    SYSTIMESTAMP,
    V_SOURCE_SITE_ID,
    NULL,
    'The MT_ONSITE master doesn''t have the dps number and ARRIV and arrive timestamp.(' || V_TMP_ONSITE.DPS_NBR || ',ARRIV,' || V_TMP_ONSITE.ARRIVE_TIMESTAMP || ')',
    SYSDATE
    UPDATE TABLE_STATUS SET STATUS='UPDATED!!',UPDATE_DATE=SYSDATE WHERE TABLE_NAME='ERR_SVC_ACTIVITY';
    COMMIT;
    ELSE
    INSERT INTO SVC_ACTIVITY02 A (
    A.ACTIVITY_ID,
    A.ACTIVITY_DESC,
    A.ACTIVITY_EFF_DATE,
    A.ACTIVITY_EFF_DTS,
    A.ACTIVITY_END_DATE,
    A.ACTIVITY_END_DTS,
    A.ACTIVITY_REASON_ID,
    A.ACTIVITY_START_DATE,
    A.ACTIVITY_START_DTS,
    A.CASE_ID,
    A.CAUSE_ID,
    A.DELL_PROD_SVC_DESC_ID,
    A.INTERACTION_ID,
    A.SVC_ACTIVITY_SRC_ID,
    A.SVC_EVENT_TYPE_ID,
    A.SVC_INTERACTION_ID,
    A.SVC_PROVIDER_ID,
    A.SVC_RESULT_ID,
    A.SVC_STATUS_ID,
    A.EXTRACT_DATE,
    A.EXTRACT_DTS,
    A.SOURCE_SITE_ID,
    A.LOAD_SEQ_NUM
    VALUES (
    TO_NUMBER(V_SOURCE_SITE_ID_N || (SELECT /*+ INDEX(MT_ONSITE IX_MT_ONSITE) */ NUMERIC_KEY FROM MT_ONSITE WHERE DPS_NBR=V_TMP_ONSITE.DPS_NBR AND STATUS_DESC='ARRIV' AND TIME_STAMP=V_TMP_ONSITE.ARRIVE_TIMESTAMP)),
    'ARRIV',
    V_TMP_ONSITE.ARRIVE_TIMESTAMP,
    TO_TIMESTAMP(TO_CHAR(V_TMP_ONSITE.ARRIVE_TIMESTAMP,'yyyy-mm-dd hh24:mi:ss')),
    V_TMP_ONSITE.COMPL_TIMESTAMP,
    TO_TIMESTAMP(TO_CHAR(V_TMP_ONSITE.COMPL_TIMESTAMP,'yyyy-mm-dd hh24:mi:ss')),
    TO_NUMBER(V_SOURCE_SITE_ID_N || (SELECT /*+ INDEX(MT_ONSITE_PROBLEM IX_MT_ONSITE_PROBLEM) */ NUMERIC_KEY FROM MT_ONSITE_PROBLEM WHERE PROBLEM_CODE=V_TMP_ONSITE.PROBLEM_CODE)),
    V_TMP_ONSITE.ARRIVE_TIMESTAMP,
    TO_TIMESTAMP(TO_CHAR(V_TMP_ONSITE.ARRIVE_TIMESTAMP,'yyyy-mm-dd hh24:mi:ss')),
    TO_NUMBER(V_SOURCE_SITE_ID_N || (SELECT /*+ INDEX(MT_CASE_HEADER IX_MT_CASE_HEADER) */ NUMERIC_KEY FROM MT_CASE_HEADER WHERE CASE_NUM=V_TMP_ONSITE.CLH_CASE_NUM)),
    TO_NUMBER(V_SOURCE_SITE_ID_N || (SELECT /*+ INDEX(MT_ONSITE_CAUSE IX_MT_ONSITE_CAUSE) */ NUMERIC_KEY FROM MT_ONSITE_CAUSE WHERE CAUSE_CODE=V_TMP_ONSITE.CAUSE_CODE)),
    TO_NUMBER(V_SOURCE_SITE_ID_N || (SELECT DELL_PROC_SVC_DESC_ID FROM M_PROD_SVC_TYPE WHERE SRC_DESC_DESC_CODE=V_TMP_ONSITE.JH_DPS_TYPE)),
    TO_NUMBER(V_SOURCE_SITE_ID_N || (SELECT /*+ INDEX(MT_CALL_LOG_HEADER IX_MT_CALL_LOG_HEADER) */ NUMERIC_KEY FROM MT_CALL_LOG_HEADER WHERE DATE_CODE=V_TMP_ONSITE.CLH_DATE_CODE AND CASE_NUM=V_TMP_ONSITE.CLH_CASE_NUM AND FLG_DELLSRV=V_TMP_ONSITE.CLH_FLG_DELLSRV)),
    TO_NUMBER(V_SOURCE_SITE_ID_N || V_TMP_ONSITE.SVC_ACTIVITY_SRC_ID),
    TO_NUMBER(V_SOURCE_SITE_ID_N || (SELECT /*+ INDEX(MT_ONSITE_ACTION IX_MT_ONSITE_ACTION) */ NUMERIC_KEY FROM MT_ONSITE_ACTION WHERE ACTION_CODE=V_TMP_ONSITE.ACTION_CODE)),
    TO_NUMBER(V_SOURCE_SITE_ID_N || (SELECT /*+ INDDEX(MT_JDPS_HEADER IX_JDPS_HEADER) */ NUMERIC_KEY FROM MT_JDPS_HEADER WHERE DPS_NBR=V_TMP_ONSITE.DPS_NBR)),
    TO_NUMBER(V_SOURCE_SITE_ID_N || (SELECT /*+ INDEX(MT_TPM_CODE IX_MT_TPM_CODE) */ NUMERIC_KEY FROM MT_TPM_CODE WHERE TPM_CODE=V_TMP_ONSITE.JH_TPM_CODE)),
    TO_NUMBER(V_SOURCE_SITE_ID_N || (SELECT /*+ INDEX(MT_ONSITE_STATUS IX_MT_ONSITE_STATUS) */ NUMERIC_KEY FROM MT_ONSITE_STATUS WHERE STATUS_CODE=V_TMP_ONSITE.STATUS_CODE)),
    V_SVC_STATUS_ID_A,
    SYSDATE,
    SYSTIMESTAMP,
    V_SOURCE_SITE_ID,
    NULL
    END IF;
    SELECT COUNT(*) INTO V_COUNT FROM MT_ONSITE WHERE DPS_NBR=V_TMP_ONSITE.DPS_NBR AND STATUS_DESC='COMPL' AND TIME_STAMP=V_TMP_ONSITE.COMPL_TIMESTAMP;
    IF V_COUNT=0 THEN
    INSERT INTO ERR_SVC_ACTIVITY E (
    E.ACTIVITY_ID,
    -- E.SOURCE_SYS_CREATE_DTS,
    E.ACTIVITY_DESC,
    -- E.ACTIVITY_DURACTION,
    E.ACTIVITY_EFF_DATE,
    E.ACTIVITY_EFF_DTS,
    E.ACTIVITY_END_DATE,
    E.ACTIVITY_END_DTS,
    -- E.ACTIVITY_NOTIFICATION_DATE,
    -- E.ACTIVITY_NOTIFICATION_DTS,
    E.ACTIVITY_REASON_ID,
    E.ACTIVITY_START_DATE,
    E.ACTIVITY_START_DTS,
    -- E.ALT_CONTACT_PHONE,
    E.CASE_ID,
    E.CAUSE_ID,
    -- E.CUSTOMER_GMT_OFFSET,
    E.DELL_PROD_SVC_DESC_ID,
    E.INTERACTION_ID,
    -- E.SECONDARY_CONTACT_NAME,
    -- E.SECONDARY_CONTACT_PHONE,
    -- E.SRC_ACTIVITY_CODE,
    E.SVC_ACTIVITY_SRC_ID,
    E.SVC_EVENT_TYPE_ID,
    E.SVC_INTERACTION_ID,
    -- E.SVC_ORG_GROUP_ID,
    E.SVC_PROVIDER_ID,
    -- E.SVC_QUEUE_ID,
    E.SVC_RESULT_ID,
    -- E.SVC_SEVERITY_ID,
    E.SVC_STATUS_ID,
    -- E.SVC_URGENCY_ID,
    E.EXTRACT_DATE,
    E.EXTRACT_DTS,
    E.SOURCE_SITE_ID,
    -- E.SOURCE_SYS_CREATE_BY,
    -- E.SOURCE_SYS_CREATE_DATE,
    -- E.SOURCE_SYS_UPDATE_BY,
    -- E.SOURCE_SYS_UPDATE_DATE,
    -- E.SOURCE_SYS_UPDATE_DTS,
    E.LOAD_SEQ_NUM,
    E.ERR_DESC,
    E.ERR_DATE
    VALUES (
    NULL, --V_TMP_ONSITE.DPS_NBR || 'COMPL' || V_TMP_ONSITE.COMPL_TIMESTAMP,
    'COMPL',
    V_TMP_ONSITE.COMPL_TIMESTAMP,
    TO_TIMESTAMP(TO_CHAR(V_TMP_ONSITE.COMPL_TIMESTAMP,'yyyy-mm-dd hh24:mi:ss')),
    V_TMP_ONSITE.COMPL_TIMESTAMP,
    TO_TIMESTAMP(TO_CHAR(V_TMP_ONSITE.COMPL_TIMESTAMP,'yyyy-mm-dd hh24:mi:ss')),
    NULL, --V_TMP_ONSITE.PROBLEM_CODE,
    V_TMP_ONSITE.ARRIVE_TIMESTAMP,
    TO_TIMESTAMP(TO_CHAR(V_TMP_ONSITE.ARRIVE_TIMESTAMP,'yyyy-mm-dd hh24:mi:ss')),
    NULL, --V_TMP_ONSITE.CLH_CASE_NUM,
    NULL, --V_TMP_ONSITE.CAUSE_CODE,
    NULL, --V_TMP_ONSITE.JH_DPS_TYPE,
    NULL, --V_TMP_ONSITE.CLH_DATE_CODE || V_TMP_ONSITE.CLH_CASE_NUM || V_TMP_ONSITE.CLH_FLG_DELLSRV,
    V_TMP_ONSITE.SVC_ACTIVITY_SRC_ID,
    NULL, --V_TMP_ONSITE.ACTION_CODE,
    NULL, --V_TMP_ONSITE.DPS_NBR,
    NULL, --V_TMP_ONSITE.JH_TPM_CODE,
    NULL, --V_TMP_ONSITE.STATUS_CODE,
    NULL, --V_SVC_STATUS_ID_C,
    SYSDATE,
    SYSTIMESTAMP,
    V_SOURCE_SITE_ID,
    NULL,
    'The MT_ONSITE master doesn''t have the dps number and COMPL and compl timestamp.(' || V_TMP_ONSITE.DPS_NBR || ',COMPL,' || V_TMP_ONSITE.COMPL_TIMESTAMP || ')',
    SYSDATE
    UPDATE TABLE_STATUS SET STATUS='UPDATED!!',UPDATE_DATE=SYSDATE WHERE TABLE_NAME='ERR_SVC_ACTIVITY';
    COMMIT;
    ELSE
    INSERT INTO SVC_ACTIVITY02 A (
    A.ACTIVITY_ID,
    -- A.SOURCE_SYS_CREATE_DTS,
    A.ACTIVITY_DESC,
    -- A.ACTIVITY_DURACTION,
    A.ACTIVITY_EFF_DATE,
    A.ACTIVITY_EFF_DTS,
    A.ACTIVITY_END_DATE,
    A.ACTIVITY_END_DTS,
    -- A.ACTIVITY_NOTIFICATION_DATE,
    -- A.ACTIVITY_NOTIFICATION_DTS,
    A.ACTIVITY_REASON_ID,
    A.ACTIVITY_START_DATE,
    A.ACTIVITY_START_DTS,
    -- A.ALT_CONTACT_PHONE,
    A.CASE_ID,
    A.CAUSE_ID,
    -- A.CUSTOMER_GMT_OFFSET,
    A.DELL_PROD_SVC_DESC_ID,
    A.INTERACTION_ID,
    -- A.SECONDARY_CONTACT_NAME,
    -- A.SECONDARY_CONTACT_PHONE,
    -- A.SRC_ACTIVITY_CODE,
    A.SVC_ACTIVITY_SRC_ID,
    A.SVC_EVENT_TYPE_ID,
    A.SVC_INTERACTION_ID,
    -- A.SVC_ORG_GROUP_ID,
    A.SVC_PROVIDER_ID,
    -- A.SVC_QUEUE_ID,
    A.SVC_RESULT_ID,
    -- A.SVC_SEVERITY_ID,
    A.SVC_STATUS_ID,
    -- A.SVC_URGENCY_ID,
    A.EXTRACT_DATE,
    A.EXTRACT_DTS,
    A.SOURCE_SITE_ID,
    -- A.SOURCE_SYS_CREATE_BY,
    -- A.SOURCE_SYS_CREATE_DATE,
    -- A.SOURCE_SYS_UPDATE_BY,
    -- A.SOURCE_SYS_UPDATE_DATE,
    -- A.SOURCE_SYS_UPDATE_DTS,
    A.LOAD_SEQ_NUM
    VALUES (
    TO_NUMBER(V_SOURCE_SITE_ID_N || (SELECT /*+ INDEX(MT_ONSITE IX_MT_ONSITE) */ NUMERIC_KEY FROM MT_ONSITE WHERE DPS_NBR=V_TMP_ONSITE.DPS_NBR AND STATUS_DESC='COMPL' AND TIME_STAMP=V_TMP_ONSITE.COMPL_TIMESTAMP)),
    'COMPL',
    V_TMP_ONSITE.COMPL_TIMESTAMP,
    TO_TIMESTAMP(TO_CHAR(V_TMP_ONSITE.COMPL_TIMESTAMP,'yyyy-mm-dd hh24:mi:ss')),
    V_TMP_ONSITE.COMPL_TIMESTAMP,
    TO_TIMESTAMP(TO_CHAR(V_TMP_ONSITE.COMPL_TIMESTAMP,'yyyy-mm-dd hh24:mi:ss')),
    TO_NUMBER(V_SOURCE_SITE_ID_N || (SELECT /*+ INDEX(MT_ONSITE_PROBLEM IX_MT_ONSITE_PROBLEM) */ NUMERIC_KEY FROM MT_ONSITE_PROBLEM WHERE PROBLEM_CODE=V_TMP_ONSITE.PROBLEM_CODE)),
    V_TMP_ONSITE.ARRIVE_TIMESTAMP,
    TO_TIMESTAMP(TO_CHAR(V_TMP_ONSITE.ARRIVE_TIMESTAMP,'yyyy-mm-dd hh24:mi:ss')),
    TO_NUMBER(V_SOURCE_SITE_ID_N || (SELECT /*+ INDEX(MT_CASE_HEADER IX_MT_CASE_HEADER) */ NUMERIC_KEY FROM MT_CASE_HEADER WHERE CASE_NUM=V_TMP_ONSITE.CLH_CASE_NUM)),
    TO_NUMBER(V_SOURCE_SITE_ID_N || (SELECT /*+ INDEX(MT_ONSITE_CAUSE IX_MT_ONSITE_CAUSE) */ NUMERIC_KEY FROM MT_ONSITE_CAUSE WHERE CAUSE_CODE=V_TMP_ONSITE.CAUSE_CODE)),
    TO_NUMBER(V_SOURCE_SITE_ID_N || (SELECT DELL_PROC_SVC_DESC_ID FROM M_PROD_SVC_TYPE WHERE SRC_DESC_DESC_CODE=V_TMP_ONSITE.JH_DPS_TYPE)),
    TO_NUMBER(V_SOURCE_SITE_ID_N || (SELECT /*+ INDEX(MT_CALL_LOG_HEADER IX_MT_CALL_LOG_HEADER) */ NUMERIC_KEY FROM MT_CALL_LOG_HEADER WHERE DATE_CODE=V_TMP_ONSITE.CLH_DATE_CODE AND CASE_NUM=V_TMP_ONSITE.CLH_CASE_NUM AND FLG_DELLSRV=V_TMP_ONSITE.CLH_FLG_DELLSRV)),
    TO_NUMBER(V_SOURCE_SITE_ID_N || V_TMP_ONSITE.SVC_ACTIVITY_SRC_ID),
    TO_NUMBER(V_SOURCE_SITE_ID_N || (SELECT /*+ INDEX(MT_ONSITE_ACTION IX_MT_ONSITE_ACTION) */ NUMERIC_KEY FROM MT_ONSITE_ACTION WHERE ACTION_CODE=V_TMP_ONSITE.ACTION_CODE)),
    TO_NUMBER(V_SOURCE_SITE_ID_N || (SELECT /*+ INDDEX(MT_JDPS_HEADER IX_JDPS_HEADER) */ NUMERIC_KEY FROM MT_JDPS_HEADER WHERE DPS_NBR=V_TMP_ONSITE.DPS_NBR)),
    TO_NUMBER(V_SOURCE_SITE_ID_N || (SELECT /*+ INDEX(MT_TPM_CODE IX_MT_TPM_CODE) */ NUMERIC_KEY FROM MT_TPM_CODE WHERE TPM_CODE=V_TMP_ONSITE.JH_TPM_CODE)),
    TO_NUMBER(V_SOURCE_SITE_ID_N || (SELECT /*+ INDEX(MT_ONSITE_STATUS IX_MT_ONSITE_STATUS) */ NUMERIC_KEY FROM MT_ONSITE_STATUS WHERE STATUS_CODE=V_TMP_ONSITE.STATUS_CODE)),
    V_SVC_STATUS_ID_C,
    SYSDATE,
    SYSTIMESTAMP,
    V_SOURCE_SITE_ID,
    NULL
    END IF;
    V_LIMIT := V_LIMIT + 1;
    IF V_LIMIT > 10000 THEN
    COMMIT;
    V_LIMIT :=0;
    END IF;
    END LOOP;
    -- カーソルのクローズ
    CLOSE C_TMP_ONSITE;
    COMMIT;
    V_LIMIT :=0;
    UPDATE TABLE_STATUS SET STATUS='COMPLETED',UPDATE_DATE=SYSDATE WHERE TABLE_NAME='SVC_ACTIVITY02';
    COMMIT;
    END IF;

    The procedure takes two optional parameters, a date, which defaults to sysdate if not passed, and an integer which defaults to 31 if not passed.
    The BITAND function does a bitwise and on msk and the constants. A bitwise and works like this. It takes the binary representation of the two numbers and compares each bit. If both are the same, then it sets the corresponding bit in the output to 1, if they are different, then the corresponding bit is 0. So
    31 binary is: 11111
    2 binary is 10
    So to do a bitand, you pad the shorter number on the left with zeroes and compare each bit so:
    11111
    00010
    00010so BITAND(31, 2) = 2
    I'm not really sure how your application is determining the value for msk to pass to the procedure, and don't have the time to decipher the posted code to see how it is really using it, but one common use for bit masks is to store several yes/no or on/off flags in a very compact form.
    For example, one application I worked with several years ago had a security model that determined for each user for each screen what they could do with that screen. The permissions were stored in a single number similar to the file permissions in UNIX. So, reading from the right:
    Bit 1 Set = Read permission
    Bit 2 Set = Insert permission
    Bit 3 set = Update Permission
    Bit 4 set = Delete permissionSo, a user who could read and update but not insert or delete would have bits set as 0101 or 5. To determine if the user could insert a record, the application would do something like:
    IF BITAND(permission_no, 2) = 1 THEN
       allow update
    ELSE
       deny update
    END IF;HTH
    John

  • View for procedures parameters

    Hello.
    Is there any view (the kind of dba_procedures) where the parameters of the procedures can be found?
    Thanks in advance.

    Hello Fernando,
    the views you are looking for are called
    All_Arguments / User_Arguments resp.
    Have nice day.
    Björn

  • SSRS Parameters help!

    Dear All, sorry my last post was not written properly.
    I need some urgent help creating a report on SSRS (Microsoft Visual Studio 2008)
    I am currently using certain parameters to get a specific data list.
    Only after this list has been created I want to use another parameter to further filter down my list
    Can someone please tell me how I go about doing this?
    Kind regards,
    JS

    Hi JS,
    Just as Kishore and RSingh suggested, we can use cascading parameter to further filter down the list. With cascading parameters, the list of values for one parameter depends on the value chosen in preceding parameter.
    There are two methods to create cascading parameters, please see:
    Method1:
    Create a new dataset query like this below:
    SELECT DISTINCT field3
    FROM            table_name
    WHERE        field1 IN (@parameter1) and field2 IN (@parameter2)
    Create parameter3 to get available values from the new dataset.
    Add a new filter to the main dataset or tablix to further filter the list.
    Method2:
    Create a new dataset query like this below:
    SELECT DISTINCT field3
    FROM            table_name
    Create two filters as below in the new dataset:
    Expression: [field1]
    Operator: In
    Value: [parameter2]
    Expression: [field2]
    Operator: In
    Value: [parameter2]
    Repeat Step2 and Step3 in Method 1.
    If there are any other questions, please feel free to let me know.
    Thanks,
    Katherine xiong
    Katherine Xiong
    TechNet Community Support

Maybe you are looking for

  • Difficulty installing Oracle 8i 8.1.1.6 on Redhat Linux 7

    Hi, I am having difficulty installing Oracle 8i 8.1.1.6 on Redhat Linux 7. The installation process runs well and the last stage when the Database Configuration Assistant is running. It successfully copies the database files but when it reaches 80% (

  • Download of OS X Mountain Lion?

    I have akready downloaded Mountain Lion for my MacBook Pro and it is running great; however, the app store is telling me under purchases to download it and in my launchpad icon below it there is a progress bar and the mountain lion icon says paused.

  • Time Char in BW

    Hi Experts, What is      Fiscal year variant      Fiscal year      Fiscal year/period      Posting Period Thanks

  • Aperture3 , aperture3

    Why Streming Photo automatically don't work in Aperture 3?

  • Setup wi-fi

    I run AirPort Extreme with my MacBook. For my IP telephone I use a Telia (the operator) Gateway. The AirPort is connected to the gateway. The operator has helped me to bridge the gateway so it does not run as a router. This is when my problems starte