DBMS_JOB.SUBMIT ( procedure call with parameter )

Hello,
I am trying to call procedure with input parameter using dbms_job.SUBMIT and it gives me the value of p_email must be declared.
declare
my_job number;
p_email varchar2(50) := 'abc';
my_pro varchar2(100) := 'BEGIN my_pkg.my_proc(' || p_email ||'); END;';
BEGIN
     DBMS_JOB.SUBMIT(JOB => MY_JOB,WHAT => my_pro);
END;     
if anybody knows how to solve please let me know ASAP.
TIA

SQL> set serveroutput on;
SQL> declare
  2    my_job number;
  3    p_email varchar2(50) := 'abc';
  4    my_pro varchar2(100) := 'BEGIN my_pkg.my_proc(' || p_email ||'); END;'
  5  BEGIN
  6   dbms_output.put_line(my_pro);
  7  END;
  8  /
BEGIN my_pkg.my_proc(abc); END;
PL/SQL procedure successfully completed.i think i should also be enclosed in single quote. see this example below.
SQL> declare
  2    my_job number;
  3    p_email varchar2(50) := 'abc';
  4    my_pro varchar2(100) := 'BEGIN my_pkg.my_proc(' ||''''|| p_email||'''' ||'); END;';
  5  BEGIN
  6   dbms_output.put_line(my_pro);
  7  END;
  8  /
BEGIN my_pkg.my_proc('abc'); END;
PL/SQL procedure successfully completed.
SQL>
your job would look like:declare
  my_job number;
  p_email varchar2(50) := 'abc';
  my_pro varchar2(100) := 'BEGIN my_pkg.my_proc(' ||''''|| p_email||'''' ||'); END;';
BEGIN
   DBMS_JOB.SUBMIT(JOB => MY_JOB,WHAT => my_pro);
END;

Similar Messages

  • Dbms_job.submit procedure called from Forms

    Folks,
    Since the DBMS_JOB.SUBMIT cannot be executed directly within a form, I created a simple procedure on the database which makes the call to DBMS_JOB.SUBMIT as follows:
    FUNCTION web_newsletter_submit_job(p_letter_id NUMBER) RETURN NUMBER IS
    v_jobnum NUMBER;
    BEGIN
    DBMS_JOB.SUBMIT (v_jobnum, 'send_mail_html2 (''DailyRacingForm<[email protected]>'', ''[email protected]'', ''DailyRacingForm<[email protected]>'', ''test subject'', ''test body'');',
    TRUNC(SYSDATE) + 22/24);
    RETURN v_jobnum;
    END;
    From SQL/Plus I can declare a varialbe and execute this procedure as follows:
    v_jobnum := web_newsletter_submit_job(22) ;
    then I can view the v_jobnum and find the job in the DBA_JOBS table.
    My problem is when I execute the 'web_newsletter_submit_job' function from with Forms, my job never gets created. The function actually returns a job number and my Form display it via the Message() function; however, the job number never shows up in DBA_JOBS table.
    Any ideas why I can successfully create the job from sql/plus but not from Forms ???
    Regards,
    Bob

    you made a FORMS_DDL('COMMIT') right? without commiting, the jobe will never get executed.
    Cheers, Stefan

  • Stored Procedure Call with only Input Parameter

    Hi, The Example at Oracle Toplink Developer's Guide, Volume 5 uses an output param named IS_VALID. How Can I Call a Stored Procedure that has only Input Param ? If I don't use an Ouput Param Toplink throw the following Exception:
    *Excepción [TOPLINK-4002]* (Oracle TopLink - 10g Release 3 (10.1.3.3.0) (Build 070620)): oracle.toplink.exceptions.DatabaseException Excepción Interna: java.sql.SQLException: ORA-00900: invalid SQL statement
    Here's the Sample Code Depicted at the Guide:*
    Example 98–48 Stored Procedure Call with an Output Parameter
    StoredProcedureCall call = new StoredProcedureCall();
    call.setProcedureName("CHECK_VALID_POSTAL_CODE");
    call.addNamedArgument("POSTAL_CODE");
    call.addNamedOutputArgument(
    "IS_VALID", // procedure parameter name
    "IS_VALID", // out argument field name
    Integer.class // Java type corresponding to type returned by procedure
    ValueReadQuery query = new ValueReadQuery();
    query.setCall(call);
    query.addArgument("POSTAL_CODE");
    Vector parameters = new Vector();
    parameters.addElement("L5J1H5");
    Number isValid = (Number) session.executeQuery(query,parameters);
    Here's my code
    StoredProcedureCall call = new StoredProcedureCall();
         call.setProcedureName("MYSTOREDPROCEDURE");
         call.addNamedArgument("INPUTPARAM1");
         call.addNamedArgument("INPUTPARAM2");
         call.addNamedArgument("INPUTPARAM3");
         call.addNamedArgument("INPUTPARAM4");
         call.addNamedArgument("INPUTPARAM5");
         call.addNamedArgument("INPUTPARAM6");
         ValueReadQuery query = new ValueReadQuery();
         query.setCall(call);
         query.addArgument("INPUTPARAM1");
         query.addArgument("INPUTPARAM2");
         query.addArgument("INPUTPARAM3");
         query.addArgument("INPUTPARAM4");
         query.addArgument("INPUTPARAM5");
         query.addArgument("INPUTPARAM6");
    Vector parameters = new Vector();
         parameters.addElement("INPUTVALUE1");
         parameters.addElement("INPUTVALUE2");
         parameters.addElement("INPUTVALUE3");
         parameters.addElement("INPUTVALUE4");
         parameters.addElement("INPUTVALUE5");
         parameters.addElement("INPUTVALUE6");
         uow.executeQuery(query,parameters);
    Regards,
    Manuel

    You need to use a DataModifyQuery as your query does not return anything.
    James : http://www.eclipselink.org

  • Asynchronous SUBMIT or CALL WITH creation of NEW SESSION

    I'm doing monotonous comparisons between systems, but I do need to see the SAP standard comparison for each. So I have an ALV list that I'd like to double click a line entry that will spawn 3 NEW SESSIONS and I'll automatically populate the parameters.
    So, has anyone been able to SUBMIT or CALL WITH THE KEY BEING THAT IT MUST CREATE 3 NEW ASYNCHRONOUS SESSIONS. I'd be grateful if you'd share your experience in this regard. Thank you, Adrian

    Hi,
    You can try in this way.
    Create a new FM and place your code there. Call this FM using addition STARTING NEW TASK. It should work fine.
    Check out F1 help on CALL FUNCTION for more details and additions.
    Thanks,
    Vinod.

  • Stored Procedure Call with Connection Pools

    Hi everybody,
    I have changed my Database-Connection to Connection Pooling.
    No I try to call a stored procedure like this:
    Connection connection;
    CallableStatement callStmt;
    Integer sp_result;
    //--- Set callable stored procedure
    String call = "{?=call myStoredProcedure(?,?,?)}";
    try {
    if( connection != null ) {
    callStmt = connection.prepareCall( call );
    callStmt.registerOutParameter( 1, java.sql.Types.INTEGER );
    callStmt.setInt( 2, 3 );
    callStmt.setString( 3, plz );
    callStmt.setString( 4, ort );
    callStmt.execute( call );
    sp_result = new Integer( callStmt.getInt(1) );
    callStmt.close();
    result = sp_result.intValue();
    } else {
    log.error( "Connection = null" );
    } catch( SQLException ex ) {
    log.error( ex.toString() );
    ServletUtils.forwardRequest(this, request, response,
    "/error.jsp", "errorMsg", ex.toString() );
    Without Connection Pooling, my Connection is of
    'weblogic.jdbc.mssqlserver4.MicrosoftConnection'
    With Connection Pooling my Connection is of
    'weblogic.jdbc2.rmi.SerialConnection'
    And now, the stored procedure can't be found anymore.
    There comes an SQLException:
    Gespeicherte Prozedur 'myStoredProcedure' konnte nicht gefunden werden.
    Severity 16, State 62, Procedure 'myDBServer null', Line 5
    One possibility is that the SerialConnection can't call the stored procedure
    like the Microsoft-specific Connection (I use MS-SQL-Server)
    Another is that the call have to be another stucture.
    I would be pleased if somebody is expirienced in this behaviour.
    Thousand thanx,
    Hammer.

    You need to use a DataModifyQuery as your query does not return anything.
    James : http://www.eclipselink.org

  • Stored procedure call with REF CURSOR from JDBC

    How can I call a SP with a REF CURSOR OUT parameter from JDBC?

    This is a breeze.
    CallableStatement oraCall = oraConn.prepareCall("BEGIN PKG_SOMETHING.RETURNS_A_SP(?);END;");
    oraCall.registerOutParameter(1,oracle.jdbc.driver.OracleTypes.CURSOR);
    oraCall.execute();
    ResultSet rsServList = (ResultSet) oraCall.getObject(1);
    ... use ResultSet ...
    rsServList.close();
    oraCall.close();
    slag

  • Procedur call with a button

    Hi,
    i have create a pl/sql procedur like
    create or replace procedure MY_PROC  (p_NAME IN VARCHAR2) as
    Now i have a button (the_button) in a region an a select list (s_List/ P123_Name)
    I want to call the procedur, but i don't now how
    I try: Button condition typ PL/SQL Expression
    EXPRESSION 1
    BEGIN
       MY_PROC (:P123_name);
    END;
    but the code ist not valid.
    can everyone explain me, how i can call this procedur?
    THX
    René

    Hi,
    What that procedure suppose to do?
    I assume your button should submit page.
    Then call procedure in after submit process.
    Button condition, is for conditionally display button.
    Not for executing procedures.
    Regards,
    Jari

  • External procedure call. PARAMETER MAXLEN doubt

    Hi, I have the following external function definition:
    CREATE OR REPLACE FUNCTION myfunc (
    tohash IN STRING,
    hashres IN OUT STRING)
    RETURN BINARY_INTEGER AS LANGUAGE C
    LIBRARY myfunc_lib
    NAME "myfunc"
    PARAMETERS (
    strin,
    strinINDICATOR,
    strout,
    strout MAXLEN,
    strout INDICATOR,
    RETURN);
    C prototype: int myfunc(char strin, short strin_ind, char strout, int strout_maxlen, short strout_ind)
    When I call it, the strout_maxlen take the pl/sql variable size value ( v_out CHAR(64) --> strout_maxlen == 64 ). The internal mechanism of call a external function take care of pass a 65 bytes buffer (to store the '\0') or if I know that I'll write 64 characters I must declare the pl/sql variable as CHAR(65)
    Thanks!
    Best regards
    Edited by: user1488139 on 26/03/2012 12:29

    Artem,
    It may be possible to do, but with ASP (active server page) code.  Here is an example:
    A WebI report runs and there are three columns of information that is generated (Report ID, Stat, and Currentdate).  Within WebI you create a local variable that looks like this:
    [VAR]
    ="http://www.myserver.com/Ext_Proc.asp?ID="+[Report ID]+"&Stat="+[Stat]+"&TimeTr="+[currentdate()+"&userinfo="+[Usr_Inf]
    You would then place the variable VAR on your grid and tag it as read as HTML.  If a user hovers over this column and executes the link it will fire off the Ext_Proc.asp code, receiving the arguments ID, Stat, and TimeTr with its values passed in.  Within the Ext_Proc.asp code you can then in-turn fire that data to your database server (or whatever you want to do with it).  If you need more info on what the ASP code might look like please reply.
    Thanks,
    John

  • How to write script calling with parameter [CS6-js (Mac)]

    I'm doing script for produsing some sound:
    var mString = "tell application \"Play Sound\"\rplay \"Mac:Users:a.ivanov:Sounds:" + "copied.wav" + "\"\rend tell"
    app.doScript(mStrtest, ScriptLanguage.applescriptLanguage);
    This work well.
    Now, i'd like to call this script from other script with any desired wav-file (not only "copied.wav" )). How to write down correctly calling other script with param.
    Thanks

    Hi,
    var myParameters = ["Mac:Users:a.ivanov:Sounds:", "copied.wav"];
    var myAppleScript = "tell application \"Play Sound\" to play  ((item 1 of arguments) & item 2 of arguments)";
    app.doScript(myAppleScript, ScriptLanguage.applescriptLanguage, myParameters);
    doScript also excepts file, so if wanted save the line myAppleScript as *.jsx and insert the Filereference in the doScript
    P.S. Assume MacOsx prior 10.5 may not include afplay

  • Help Regarding DBMS_JOB.SUBMIT

    I Have Job Like this
    DECLARE
    X NUMBER;
    BEGIN
    SYS.DBMS_JOB.SUBMIT
    ( job => X
    ,what => 'CSNG.CS_JSP_RQST;'
    ,next_date => to_date('13/06/2008 01:00:00','dd/mm/yyyy hh24:mi:ss')
    ,interval => 'TRUNC(SYSDATE+1) + (1/24)'
    ,no_parse => TRUE
    SYS.DBMS_OUTPUT.PUT_LINE('Job Number is: ' || to_char(x));
    END;
    commit;
    'CSNG.CS_JSP_RQST' Procedure is executing every day ..
    i want to execute it only when
    in CS_JSP_TABLE column "CREATE DATE=SYSDATE"
    can anyone tell how to do this
    any suggestions please ..
    Thanks in advance ..
    Message was edited by:
    Data Boy
    Message was edited by:
    Data Boy

    you will need to put the procedure CSNG.CS_JSP_RQST in another procedure to call it. then have a logic that checks for the value of the column create_date with today's date in the table CS_JSP_TABLE. if that match call the procedure CSNG.CS_JSP_RQST. something like to this example below:
      create or replace procedure CSNG.CS_JSP_CALL as
        vCnt     number := 0;
      begin
         select count(*)
           into vCnt
           from CS_JSP_TABLE
          where trunc(create_date) = trunc(sysdate);
         if vCnt > 0 then
           CSNG.CS_JSP_RQST;
         end if;
      end;
    in your DBMS_JOB.SUBMIT you call the procedure CSNG.CS_JSP_CALL.
      declare
        x number;
      begin
        sys.dbms_job.submit ( job => X ,
                              what => 'CSNG.CS_JSP_CALL',
                              next_date => to_date('13/06/2008 01:00:00','dd/mm/yyyy hh24:mi:ss'),
                              interval => 'TRUNC(SYSDATE+1) + (1/24)',
                              no_parse => TRUE );
        sys.dbms_output.put_line('Job Number is: ' || to_char(x));
        commit;
      end;
    /

  • Oracle Stored Procedure Call

    Hi,
    I have an Oracle Stored Procedure that I must be calling. The procedure takes two IN parameters, and returns a CHAR(1000) string, not via the OUT parameter, but as normal return.
    I have read articles about how to make Procedure Calls with OUT parameters, but didnt find any on my case. I have tried several options but still get parameter binding errors.
    What I am trying right now is this:
    If anyone
    <b>======== code ==============</b>
    SQLParameter[] params = new SQLParameter[2];
    // Construct three objects corresponding to initial values
    Object objMsisdn = new String("9656364550");
    Object objUsername = new String("abc");
    String output;
    // prepare the oracle procedure parameters
    params[0] = new SQLParameter(objMsisdn, Types.VARCHAR, SQLParameter.IN);
    params[1] = new SQLParameter(objUsername, Types.VARCHAR, SQLParameter.IN);
    try{
    output = custDetDB.getCustDetails(params);
    <b>========================================</b>
    Java DB Control:
    <b>========================================</b>
    * @jc:sql statement="{call www_custdet(?,?)}"
    String getCustDetails(SQLParameter[] params) throws SQLException;
    Right now I am getting "Not All Variables Bound Error". I tried to have all IN & OUT parameters sent as SQLParameter before but that didnt work either.
    Any hints?

    Bashar Abdullah wrote:
    Hi,
    > I have an Oracle Stored Procedure that I must be calling. The procedure takes two IN parameters, and returns a CHAR(1000) string, not via the OUT parameter, but as normal return.
    As far as I know, it is impossible for an Oracle
    stored procedure to return anything except
    as output parameters. Show the text of the procedure,
    and tell us what JDBC driver you're using.
    Joe
    I have read articles about how to make Procedure Calls with OUT parameters, but didnt find any on my case. I have tried several options but still get parameter binding errors.
    > What I am trying right now is this:
    If anyone
    > <b>======== code ==============</b>
    > SQLParameter[] params = new SQLParameter[2];
    >
    // Construct three objects corresponding to initial values
    > Object objMsisdn = new String("9656364550");
    > Object objUsername = new String("abc");
    > String output;
    >
    > // prepare the oracle procedure parameters
    > params[0] = new SQLParameter(objMsisdn, Types.VARCHAR, SQLParameter.IN);
    > params[1] = new SQLParameter(objUsername, Types.VARCHAR, SQLParameter.IN);
    >
    try{
    > output = custDetDB.getCustDetails(params);
    > <b>========================================</b>
    > Java DB Control:
    > <b>========================================</b>
    > /**
    > * @jc:sql statement="{call www_custdet(?,?)}"
    > */
    > String getCustDetails(SQLParameter[] params) throws SQLException;
    >
    > Right now I am getting "Not All Variables Bound Error". I tried to have all IN & OUT parameters sent as SQLParameter before but that didnt work either.
    >
    Any hints?

  • Regional settings influences jdbc stored procedure calls?

    Hi,
    We have a strange problem: we use a jdbc test client
    that does a simple stored procedure call with one
    input parameter (integer) and one output parameter
    (integer). Like:
    "? = callprocedure(?)" . The database resides on a different server.
    The problem is: this only works when we use "netherlands" regional setting on the windows 2000 machine that
    java client program runs on. If we switch to
    "english (united states)" the call gives other results
    in the output parameter / returns an error code.
    Does this have something to do with the Locale of the
    virtual machine? Or do I have to do something with
    NLS_LANG to eliminate the behaviour that is dependent on
    the windows regional settings? Please help!
    Thanks,
    Michel Schudel
    We use the Oracle JDBC thin driver, latest version.
    (archive: classes12.zip)

    Ok, here it is. Basically, I first call a stored procedure called SETPARAM which receives two Strings:
    a parameter name and a a parameter value. After that, I
    call a procedure called RUNSQLKIT without any input parameters. The output parameter is an integer that indicates the number of "cells" in the output message. After that, I start to retrieve the cells but that is not important here. What happens is: with Dutch regional settings, the number of cells is normal (387) but with
    US settings, the number of cells is -1 (indicates an error.) Why? I use no dates or floating point values as
    input/output!
    Jvm version is 1.3.1_08, oracle driver is 8.1.7
    (Oracle 8i) thin jdbc driver. Oracle runs on AIX.
    conn = m_dataSource.getConnection();
    // Setup the input params
    stmtInput = conn.prepareCall("BEGIN Pck_Sqlmast.setparam(?,?); END;");
    for (final Iterator iter = m_kitParameterNames.iterator(); iter.hasNext();) {
    final String sName = (String) iter.next();
    final String sValue = input.getParameter(sName);
    if (sValue != null) {
    stmtInput.setString(1, sName);
    stmtInput.setString(2, sValue);
    stmtInput.executeUpdate();
    // Call the kit
    stmtRun = conn.prepareCall("BEGIN ? := Pck_Sqlmast.runsqlkit(?); END;");
    stmtRun.registerOutParameter(1, Types.INTEGER);
    stmtRun.setString(2, m_kitName);
    stmtRun.executeUpdate();
    final int iCells = stmtRun.getInt(1);
    Hi Michel,
    Perhaps you would care to post some more information
    including:
    1. Entire error message and stack trace you are
    getting.
    2. The part of your java code where the error
    occurs.
    3. Java version you are using.
    4. Oracle database version you are using.
    5. Platform on which Oracle database is running.
    Good Luck,
    Avi.

  • DBMS_JOB.SUBMIT guidance.

    DBMS_JOB.SUBMIT (
    job OUT BINARY_INTEGER,
    what IN VARCHAR2,
    next_date IN DATE DEFAULT sysdate,
    interval IN VARCHAR2 DEFAULT 'null',
    no_parse IN BOOLEAN DEFAULT FALSE,
    instance IN BINARY_INTEGER DEFAULT any_instance,
    force IN BOOLEAN DEFAULT FALSE);
    Guys,
    I've come across a script in which the DBMS_JOB.SUBMIT is invoked with just the 'job' and the 'what' inputs. In such case, when would the job kick off?
    Thank you!!
    Regards,
    Bhagat

    Not sure what is your exact question. But, when you execute this script with proper param value the job will be kicked off. And, interval is the param where you specify the gap between two consecutive execution.
    Regards.
    Satyaki De.

  • Correct in dbms_job.submit to run midnight?

    Hi,
    Can you tell me if this is correct to run midnight everyday? Thanks.
    dbms_job.submit(:jobNUM,
    'package.procedure();', trunc(sysdate)+1,
    'trunc(sysdate)+1')

    Hi SD,
    Yes, the Job Submit is right.
    DECLARE
       job_no   NUMBER;
    BEGIN
       DBMS_JOB.submit (job_no,
                        'zero;',
                         TRUNC (SYSDATE) + 1,
                        'TRUNC(SYSDATE)+1',
                        FALSE
    COMMIT;
    END;To View the Jobs,
    SELECT *
      FROM USER_JOBS;When ever you Submit a job via DBMS_JOB.submit procedure, the Job Should be commited, then only the Job queue monitor can see the Job.
    As a result,uncommited jobs go undone.
    Hope this may help you.
    But, Please close your previous Posts when you are prepared to ask questions in the forum. Every one take their own valuable time to help
    you in the Forum.
    Thanks,
    Shankar

  • DBMS_JOB.REMOVE procedure

    Hi,
    I submitted a Stored Proc as an Oracle JOB using DBMS_JOB.SUBMIT procedure to execute everyday. I checked it in DBMS_JOBS and USER_JOBS views, I couldn't find it. I submitted the job again. Now that I could see two jobs scheduled (the same procedure) for a daily execution. If I remove the jobs using DBMS_JOB.REMOVE procedure and check the dbms_jobs view in the same session, I cannot see the jobs as scheduled. When I check from another session, the jobs are still scheduled and both of them gets executed on a daily basis now, which I don't need. Why the DBMS_JOB.REMOVE is not removing the job from the job queue? Any clue?
    My Oracle Version is 9.2
    meetme

    If you have exited from the session using exit, then, the job which you remove should have gone. I mean, when you use exit from the session pre-commit take place.

Maybe you are looking for

  • SJSAS 9 fails to deploy application

    Hi, This forum isn't very relevant to my problem, but it's the most relevant one I could find. I'm trying to deploy an enterprise application packaged in an .ear file which contains an EJB jar and a web war file. It gives the error pasted below while

  • Where to customize the company's withholding tax ID in SAP

    Hello, I would like to get the 1099 report for US tax withholding to be displayed with the company tax ID in the header. When executing transaction for Generic tax withholding reporting, the system can display the company tax ID in the header (it is

  • How to manage a "nice" url if APEX uses web pl/sql and not Apache?

    Hi all, How can I create a pretty url without using redirects or frames since APEX is using web pl/sql and not Apache? This is on version 4.0.1. We want the users to access the Apex App from a nice url without the traditional long url. Thanks, Veena.

  • GZIPPed  XMLEncoded HttpRequest post parameter!

    Hi All, I'm devolping a standalone java application that builds some kinds of objects and needs to send them to a servlet in xml fashion (via HttpUrlConnection with "post" method). My problem is that now this objects are too big so i thought: no prob

  • Seeded LOV in OA Page works on internal server, does not in external server

    I am using the appraisal creation page '/oracle/apps/per/selfservice/appraisals/webui/MASetupDetailsPG'. Here we have a LOV that lists the appraisal template. The LOV returns records when Pressing 'Go' from the LOV Search page while accessing from in