Set out parameter in procedure for dbms_scheduler

I see example for a dbms_scheduler setting in parameter values but what about if it is an out parameter ?
create or replace procedure vd_tst (v_id out number) as
begin
v_id := to_number(to_char(sysdate,'YYYYMMDDHH24MISS'));
end vd_tst
how do I set a hook to do an alert let say for dbms_scheduler
let say
if v_id mod(9)==0 then <alarm>

"what about if it is an out parameter ?"
An out parameter must be given a variable defined in a PL/SQL block, so to run a job that calls a procedure that has an out parameter, build a PL/SQL block with the parameter declaration and procedure call. Create the job with job type PLSQL_BLOCK.
Using a special delimited string (q'<delimiter><string><delimiter>'  Literals) is helpful for this
For example:
begin  DBMS_SCHEDULER.CREATE_JOB (
     job_name             => 'Test_message_inserter'
   , job_type             => 'PLSQL_BLOCK'
   , job_action           =>
q'!declare v_time varchar2(30);
begin
v_time := to_char(sysdate, 'DD-mon-yyyy hh24:mi:ss');
insert into t2(id, name) select SEQ_JOURNAL.nextval,v_time from dual;
commit;
end;
   , repeat_interval      => 'FREQ=secondly;interval=30'
   , enabled              => TRUE
   , comments             => 'Test job'
end

Similar Messages

  • How to set the parameter selection *optional* for each subreport?

    Hi,
    I am using Crystal Reprots 11.
    I create 10 subreports, and each subreport contains a Parameters Field.
    The 10 subreports are put in 10 footer sections in increasing order, i.e. subreport1, subreport2, subreport3, ..., subreport10.
    When I use "Print Preview" to take a look at the whole report, CR prompts a "Edit Values" window for selecting parameter values for all 10 subreports.
    For example, if I only select parameter values for subreport1 and click "OK", 9 error messages on the "Edit Values" window come out above the selection list box of every other subreports (i.e. subreport2 ~ subreport10) showing that: 'The value is not valid'.
    Sometimes, I just want to review some specific subreports but not all.
    How should I do to set the parameter selection optional (not mandatory) for each subreport?
    Thank you in adavance.
    Edited by: Holdup on Feb 17, 2012 3:44 PM

    Hi,
    Here's how you can make the prompts optional (Assuming you're using CR 2008 or higher):
    1) Go into each subreport
    2) You should see the parameter in the Field Explorer. Right-click the name and select Edit > Look for an option called 'Optional Prompt'. Set it to true
    3) If you have a record selection in the subreport, then you need to modify the selection formula to something like this:
    if not(hasvalue({?Parameter_Name})) then True else = {?Parameter_Name}
    Hope this helps!
    -Abhilash

  • How to return more than one record through OUT parameter in procedure

    Hi,
    I want to create a procedure which accepts one input and returns more than one record as output.
    example:
    Input = DeptNo
    Output= Empno,ename,sal,comm,job
    Scenario:
    There can be more than one employee in department we pass as the IN parameter. OUT parameter has to return all the records of the corresponding employee details in that department.
    Thanks in advance for your help
    Regards,
    K.Vijay

    -- I think you can try something like this using ref cursor:
    -- create a package for the type ref cursor and execute
    CREATE OR REPLACE PACKAGE PACK_REFCURSOR_FOR_TABLES AS
         TYPE DATA_TableRows IS REF CURSOR;
    END;
    -- after executing the package above, create your procedure:
    CREATE OR REPLACE PROCEDURE GET_EMP (
         IN_nDeptNo IN number,
         OUT_Emp OUT PACK_REFCURSOR_FOR_TABLES.DATA_TableRows)
    IS
    BEGIN
    -- leave query open (implicit) as this will return data
         OPEN OUT_Emp FOR
         SELECT *
         FROM tblEmp
         WHERE DeptNo = IN_nDeptNo;
    END;
    --execute the procedure and you're done                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Using IN OUT parameter in procedures

    Hello Experts ;
    Good morning all;
    i am trying to  execute a program using procedure ( IN and IN OUT ) parameter.
    i have a emp table i want to update perk  column details.
    >> Here is coding >>
    1  create or replace procedure emp_salary
      2  (id IN emp.eid%type , salary IN OUT emp.esalary%type) IS
      3  tmp_sal number;
      4  BEGIN
      5  select esalary into tmp_sal from emp  where eid=id;
      6  if tmp_sal between 10000 and 20000 THEN
      7  salary_inout := tmp_sal*1.2;
      8  else if tmp_sal between 20001 and 29999 THEN
      9  salary_inout := tmp_sal*1.8;
    10  ELS IF tmp_sal > 30000 then
    11  salary_inout := tmp_sal*2.0;
    12* END;
    SQL> /
    Warning: Procedure created with compilation errors.
    SQL> show errors;
    Errors for PROCEDURE EMP_SALARY:
    LINE/COL ERROR
    10/5     PLS-00103: Encountered the symbol "IF" when expecting one of the
               following:      := . ( @ % ;   The symbol ";" was substituted for "IF" to continue.
    12/4     PLS-00103: Encountered the symbol ";" when expecting one of the
             following: if
    MY DB version is : 10.2.0.1
    emp details :
    SQL> select * from emp;
    |EID | ENAME  |  EQUAL |  ESALARY | ECITY     |  EPERK   |    
    1    sona    |   mba  |  10000   | ********    |            |
    2    maya   |   mca  |  15000   |  **********|            |
    3    sony    |   msc   |  20000   |  ****         |            |
    4    King    |   m.s   |  22000   |  **********|             |
    5    ford     |   m.s   |  40000   | **********|              |
    Thanks in advance ;

    Hello all ;
    Thanks for all replies.  I slightly modified  my code because to understand without  any doubt.
    nothing , just removed  salary_inout.
    >> My table  details >>
    SQL> desc emp;
    Name                                      Null?    Type
    EID                                                      NUMBER
    ENAME                                               VARCHAR2(15)
    EQUAL                                               VARCHAR2(10)
    ESALARY                                           VARCHAR2(15)
    ECITY                                                 VARCHAR2(15)
    EPERK                                                NUMBER
    ECONTACT_NO                                NUMBER
    >> Dummy Records  >>
    SQL> select * From emp;
        EID   ENAME       EQUAL      ESALARY     ECITY         EPERK 
         1       sona              mba         10000             XXXXXX  
         2       maya             mca         15000             XXXXXX
    so ,  i want  to create procedure to increment salary as per conditions.
    SQL> create  or  replace  procedure   emp_salary
      2  (id  IN  emp.eid%type ,
      3  salary IN OUT emp.esalary%type ) IS
      4  tmp_sal  number;
      5  BEGIN
      6  select esalary into tmp_sal from emp  where eid=id;
      7  if tmp_sal between 10000 and 20000 THEN
      8   salary := tmp_sal*1.2;
      9  else if tmp_sal between 20001 and 29999 THEN
    10   salary := tmp_sal*1.8;
    11  ELSE IF tmp_sal > 30000 then
    12   salary := tmp_sal*2.0;
    13  END IF;
    14  END IF;
    15  END IF;
    16  END;
    17  /
    Procedure created.
    >> Here , i am getting error  >>
    SQL> execute   emp_salary;
    BEGIN emp_salary; END;
    ERROR at line 1:
    ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'EMP_SALARY'
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    My DB version is : 10.2.0.1.0  on OEL 4.4  ( Personal  database - for self studies).
    I have some doubts  please , please  .........  clear  my doubt !
    1.  when creating procedure  for  some columns  from  original table ,
      - i always use  following method .
      local_vaibale_name   <table_name>.<org_column_name>%type ; that is ,
        id  emp.eid%type;   - then why i am getting error ?
    Please  find my error and help me to resolve it.
    Thanks.

  • How to pass Single record set out to another Procedure in a LOOP

    In my complete Order lines FOR LOOP, I want to pass one line out to call another program to perform the insert or update action. How to write
    PROCEDURE order_line_process
      p_username      IN VARCHAR2,
      p_id            IN OUT NUMBER,
      my_orderdtl_tbl IN OUT my_orderdtl_tbl_type
    ) IS
    BEGIN
      FOR x IN 1 .. my_orderdtl_tbl.count LOOP
        IF my_orderdtl_tbl(x).update_flag = 'I' THEN
          order_line_insert(p_username      => p_username,
                            p_id            => p_id,
                            my_orderdtl_tbl => my_orderdtl_tbl(x));  --- how do I pass only one line info here? Do I have to assign/pass all column?
        END IF;
      END LOOP;
    END order_line_process;Thanks

    My example still works:
    SQL> create or replace package test2 is
      2  type my_orderdtl_rec_type is record (a number,b varchar2(10),update_flag char(1));
      3  type my_orderdtl_tbl_type is table of my_orderdtl_rec_type index by binary_integer;
      4  end;
      5  /
    Package created.
    SQL> create or replace procedure order_line_insert(p_user varchar2, p_id number, my_orderdtl_tbl test2.my_orderdtl_rec_type) is
      2  begin
      3   null;
      4  end;
      5  /
    Procedure created.
    SQL> create or replace  PROCEDURE order_line_process
      2  (
      3    p_username      IN VARCHAR2,
      4    p_id            IN OUT NUMBER,
      5    my_orderdtl_tbl IN OUT test2.my_orderdtl_tbl_type
      6  ) IS
      7  BEGIN
      8
      9    FOR x IN 1 .. my_orderdtl_tbl.count LOOP
    10      IF my_orderdtl_tbl(x).update_flag = 'I' THEN
    11        order_line_insert(p_username,
    12                          p_id,
    13                          my_orderdtl_tbl(x));
    14      END IF;
    15
    16    END LOOP;
    17
    18  END order_line_process;
    19  /
    Procedure created.But if you're using the following syntax to pass parameters:
    SQL> create or replace  PROCEDURE order_line_process
      2  (
      3    p_username      IN VARCHAR2,
      4    p_id            IN OUT NUMBER,
      5    my_orderdtl_tbl IN OUT test2.my_orderdtl_tbl_type
      6  ) IS
      7  BEGIN
      8
      9    FOR x IN 1 .. my_orderdtl_tbl.count LOOP
    10      IF my_orderdtl_tbl(x).update_flag = 'I' THEN
    11        order_line_insert(p_username => p_username,
    12                          p_id,
    13                          my_orderdtl_tbl(x));
    14      END IF;
    15
    16    END LOOP;
    17
    18  END order_line_process;
    19  /
    Warning: Procedure created with compilation errors.
    SQL> sho err
    Errors for PROCEDURE ORDER_LINE_PROCESS:
    LINE/COL ERROR
    11/7     PL/SQL: Statement ignored
    11/7     PLS-00306: wrong number or types of arguments in call to
             'ORDER_LINE_INSERT'Dublecheck the parameters name in the order_line_insert procedure
    SQL> create or replace  PROCEDURE order_line_process
      2  (
      3    p_username      IN VARCHAR2,
      4    p_id            IN OUT NUMBER,
      5    my_orderdtl_tbl IN OUT test2.my_orderdtl_tbl_type
      6  ) IS
      7  BEGIN
      8
      9    FOR x IN 1 .. my_orderdtl_tbl.count LOOP
    10      IF my_orderdtl_tbl(x).update_flag = 'I' THEN
    11        order_line_insert(p_user => p_username, -- THE ERROR WAS HERE!!! CORRECT PARAMETER NAME IS P_USER
    12                          p_id => p_id,
    13                          my_orderdtl_tbl => my_orderdtl_tbl(x));
    14      END IF;
    15
    16    END LOOP;
    17
    18  END order_line_process;
    19  /
    Procedure created.Max
    http://oracleitalia.wordpress.com

  • Out parameter in Procedure

    Hello,
    I have a doubt. Can anyone plz tell me.
    How can I catch the out parameter from a procedure in my JDBC code.
    Thanks
    RD

    By "procedure", I assume you mean a stored procedure. This is done by using a CallableStatement, and appropriately setting the input and output parameters. This should be relatively straightforward if you alreadt know PreparedStatement; if you don't, you should learn because it's more efficient, easier and more secure.
    there is a good example of using a CallableStatement with output parameters in reply 9 of this forum thread:
    http://forum.java.sun.com/thread.jspa?forumID=48&threadID=641810
    Note that there's a major bug in that example, which is corrected a few postings down in the thread.

  • Setting up new pricing procedure for purchasing .

    Hi Gurus
    I have to set up a pricing procedure in which calculation for allowances(discounts) should not happen during goods receipt but during invoice the discount amount should be deducted from the gross price
    The PO is created for 100$  and allowances are 10$ so during goods receipt GR/IR account should be credited for 100$ but during invoice vendor should be credited only 90$ and 10$ should be go to a different account as discount .
    Any idea please how we can map this in pricing procedure .means how the condition type should be set up in the calculation schema .
    Thanks
    Mahendra .

    Hi,
    Then this is not the Normal Discount, it is Cash Discount.
    This can be achieved through Payment Terms.
    In OME2, for the payment term, Maintain the Cash Discount Percentage Rate and the no. of days for calculation of payment due date.
    In M/08, add condition type "SKTO", Mark as "Statistical" and Assign Reqmt. as "17".

  • Set-up tax Calculation procedure for Morocco

    Where can I found information to set-up the tax Calculation procedure for Morocco and the VAT codes

    Check whether this link is useful.
    http://help.sap.com/bp_bblibrary/600/BBlibrary_start.htm
    Otherwise, check in google.
    Regards,
    Ravi

  • Set-up tax Calculation procedure for Israel

    Where can I found information to set-up the tax Calculation procedure for Israel and the VAT codes

    Check if this is any use:
    http://help.sap.com/bp_bblibrary/600/BBlibrary_start.htm
    Regards,
    Ravi

  • Blob type parameter in procedure for display issue. Oracle portal bug?

    Hi Guy,
    I am not sure this is a bug or not for oracle portal.
    I have a table that have a column type as blob.
    by oracle portal10g, this column should be display as Item Type Upload (Binary) at Item Level Options.
    We can create a form to display this file and modify it.
    However, It can not to use a procedure with a blob column to create the same form as above. we can not find Item Type as Upload (Binary) in form. if we choose text area.
    We will get a error "ORA-01403: no data found (WWV-11230)"
    We find this issue during convert clob column to blob type in procedure for a form using.
    This is a simple procedure.
    See below source codes:
    Thanks for any help.
    create or replace Procedure test_file
    (     p_DOCUMENT_ID      IN OUT file.DOCUMENT_ID%type,
         p_USER_ID           out file.USER_ID%type,
         p_DOCUMENT_NAME out file.DOCUMENT_NAME%type,
         p_DOCUMENT      out      blob,
         p_CREATED_BY           out file.CREATED_BY%type,
         p_CREATED_TIMESTAMP      out file.CREATED_TIMESTAM%type,
         p_UPDATED_BY           out file.UPDATED_BY%type,
         p_UPDATED_TIMESTAMP      out file.UPDATED_TIMESTAMP%type,
         p_DOCUMENT_DESC      out file.DOCUMENT_DESC%type) as
    L_DOCUMENT BLOB;
    begin
    begin
    SELECT USER_ID , DOCUMENT_NAME,DOCUMENT, DOCUMENT_MIME, CREATED_BY, CREATED_TIMESTAMP,
         UPDATED_BY , UPDATED_TIMESTAMP, DOCUMENT_DESC
    INTO p_USER_ID , p_DOCUMENT_NAME,L_DOCUMENT, p_DOCUMENT_MIME, p_CREATED_BY, p_CREATED_TIMESTAMP,
         p_UPDATED_BY , p_UPDATED_TIMESTAMP, p_DOCUMENT_DESC
    FROM file
    WHERE DOCUMENT_ID = p_DOCUMENT_ID;
    exception
    when NO_DATA_FOUND then
    null;
    end;
         p_DOCUMENT :=L_DOCUMENT;
    exception
    when others then
    null;
    end;

    Hi,
    I have created a vo with transient attributes and attached the vo to the am.
    But when I am trying to insert the row from my collection, it is giving me '
    oracle.jbo.NoDefException: JBO-25058: Definition of resField of type Attribute not found in ResVO
    But I have the transient attribute resField in my ResVO and I attached the same to AM also
    I am trying to get the VO in my controller like the below:
    OAViewObject resvo = (OAViewObject) am.findViewObject("ResVO");
    if(vo==null)
    resvo = am.createViewObject("ResVO","xxcust.oracle.apps.xxcust.server.ResVO");
    if(vo!= null)
    resvo.executeQuery();
    //Creating and inserting values into the vo
    Row row = resvo.createRow();
    resvo.insertRow(row);
    row.setAttribute("resField", "AB");
    row.setAttribute("Value", "CD");
    row.setAttribute("Desc", "Test");
    When I am running my page, I am getting the
    oracle.jbo.NoDefException: JBO-25058: Definition of resField of type Attribute not found in ResVO
    I checked the spelling and the attribute name is correct.
    Is it the problem with VO having all the transient attributes or am I missing something?
    I appreciate your help...

  • How to set the parameter ID value for a range

    I am trying to call transaction KSB1 (Display actual line items for cost center) by supplying all the default values for the selection options/parameters and skipping the selection screen from the calling program. However, for the cost center range, both HIGH and LOW field have the same PID (i.e. KOS). Same thing for the cost element range. When I set the value for PID "KOS", only the low value got populated.
    I tried to pass a BDC table to the
    CALL TRANSACTION 'KSB1' USING  bdc_tab
    , but the PID used before takes higher priority so the bdc_tab values got overwritten by the PID values for those fields.
    Does anybody know how to find or set the PID for a selection range? I need PID for Cost center range, cost element range and the period (PID="VPE").
    Any advice is appreicated. Thank you
    Minami

    otherwise try to make use of SUBMIT command.
    <b>Hi Preetahm ,
    KSB1 is a Report , not a Tcode to maintain master data or any thing like that ?, u can also cross check?</b>
    by using SUBMIT command u have to <b>RKAEP000</b> this program along with the selection screen.
    regards
    Prabhu
    Message was edited by: Prabhu Peram

  • Approval Procedure for Out Going Payments

    Hi All,
    I need to set up an approval procedure for Outgoing payments.
    Terms & Conditions:
    Documents Should go for approval only when a Outgoing Payment is raised by choosing the cash account in Cash tab.
    Is there any default Procedure to setup this Approval Procedure.
    Please do the needfull.
    Regards,
    Aarbz

    For outgoing payments you can set approval procedure only for version 8.8. Then you can apply a query based approval with a query like this:
    If  $[OVPM.CashAcct]='38110000'
    Select 'true'

  • Sample using XMLTYPE out parameter

    Hi, all
    any full sample source code using ODP.NET and XMLTYPE out parameter?
    PROCEDURE OBTENER_DATOS_DESPLIEGUE(pPROYECTO IN VARCHAR2,
                      pETIQUETA IN VARCHAR2 DEFAULT NULL,
                      pMOMENTO OUT TIMESTAMP,
                      pDATOS OUT XMLTYPE)
    And for testing: function and procedure.
    FUNCTION FRKDATA_GET_XMLTYPE(num IN NUMBER, xml1 IN XMLTYPE) RETURN XMLTYPE IS
      xmlout XMLTYPE;
      BEGIN
      SELECT XMLTYPE_COL
      INTO xmlout
      FROM POC_TEST_XML_TABLE
      WHERE NUM_COL = num;
      RETURN xmlout;
      END FRKDATA_GET_XMLTYPE;
    PROCEDURE FRKDATA_TESTXML(qry in VARCHAR2, rslt OUT XMLTYPE) AS
    BEGIN
    rslt := dbms_xmlgen.getxmltype(qry);
    END FRKDATA_TESTXML;
    View in https://entlib.codeplex.com/discussions/454750
    I get "connection is closed" errors
    Only, I've found this sample, but without OUT parameters.
    create or replace function xmlproc(v1 in xmltype) return xmltype is
    begin
    return v1;
    end;
    using System;
    using System.Data;
    using Oracle.DataAccess.Client;
    using Oracle.DataAccess.Types;
    class Program
        static void Main(string[] args)
            using (OracleConnection con = new OracleConnection())
                con.ConnectionString = "user id=scott;password=tiger;data source=orcl";
                con.Open();
                using (OracleCommand cmd = new OracleCommand("",con))
                    cmd.CommandText = "xmlproc";
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.Add(new OracleParameter("return", OracleDbType.XmlType)).Direction = ParameterDirection.ReturnValue;
                    cmd.Parameters.Add(new OracleParameter("v1", OracleDbType.XmlType)).Direction = ParameterDirection.Input;
                    cmd.Parameters["v1"].Value = "<a>b</a>";
                    cmd.ExecuteNonQuery();
                    Console.WriteLine(((OracleXmlType)cmd.Parameters["return"].Value).Value);

    The below works for me.
    PROCEDURE "XMLPROC" (
      "PARAM1" OUT XMLTYPE) IS
    BEGIN
      PARAM1 := dbms_xmlgen.getxmltype('SELECT FIRST_NAME FROM EMPLOYEES WHERE EMPLOYEE_ID=100');
    END;
    OracleConnection con = new OracleConnection();
    con.ConnectionString = conString;
    con.Open();
    OracleCommand cmd = con.CreateCommand();
    cmd.CommandText = "xmlproc";
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add(new OracleParameter("xmlout", OracleDbType.XmlType)).Direction = ParameterDirection.Output;
                cmd.ExecuteNonQuery();
                Console.WriteLine(((OracleXmlType)cmd.Parameters["xmlout"].Value).Value);

  • Excise duty in the Pricing Procedure for Local Purchase / Importation

    Hi,
    I'd like to know how to set up the pricing procedure for the purchase of an IS Oil Material; for local purchase and importation, especially with regards to the excise duty posting.
    Local purchase:  the vendor will bill us inclusive of the ED tax he previously paid, so the tax is just passed on to us..  My receiving location has ED paid status. In the PO item, we need to see this price (inclusive of tax) in the net price field.
    Importation:  the vendor only bills us the cost of the material.  When we received the fuel, we paid ED tax to local tax authorities.
    I know that both in these scenarios, the system has to determine the excise duty.
    My questions are (1) how do you set up the excise duty condition type  in the pricing procedure(or do they have to be maintained in the pricing procedure?) ?   and (2)  how do you set up this condition type in the config?
    Thank you and hoping for your immediate feedback.
    zccr

    Hi,
    You can use same pricing procedure
    put 4 in subtotal in pricing procedure against the Discounr or freight cond
    and in taxinn
    BASb ALTCBV 362 and for jmop 363
    But this will work only if same  discount or freight value is in IV as that given in PO
    if freing value changes in IV then its a problem
    This is SAP bug, and SAP workes in that way only, freight value should be same in PO and IV
    other solution
    in taxinn create tax code like v8 vat 4% for 003 tax clasification
    in ftxp create tax code V8 desc vat 4%
    in fv11 for jvrd put 4
    and at the time of IV put this tax code for freight amount
    and for regular material value V1 tax code
    this will work only if u have used acess seq MWST instead of JTAX pr JST1
    hope this helps
    Vipin

  • Time Out parameter in SAP BW

    Hello
    I wanted to know if the Time Out Parameter in SAP BW shoul have the same value of the business object time Out parameter?
    Thanks for your help.

    Hi,
    In BW you will rdisp/wp_max_runtime has a program execution timeout parameter ..
    BO is a web-based application and hence it will not have same parameter. In BO you will have HTTP timeout parameter.
    Hope this helps.
    Regards,
    Deepak Kori

Maybe you are looking for