Call a Vbscript from a stored procedure

Hi,
I wonder is it possible to call a Vbscript from a stored procedure, any good reference for this.
thanks

Well here is quick and dirty example I just created.
Step 1. Create a test_batch.bat file that creates a folder "c:\test_dir" and copy "c:emp.lst" into it.
C:\oracle102\examples\test_batch.bat
md c:\test_dir
copy c:\emp.lst c:\test_dir
Step2. From SQLPLUS, spool scott.emp into c:\emp.lst and call the batch from the dbms_scheduler that kicks off right away,
set echo off
set feedback off
spool c:\emp.lst;
select * from scott.emp;
spool off;
begin
     dbms_scheduler.create_job(job_name => 'run_batch',
     job_type => 'EXECUTABLE',
     job_action => 'C:\oracle102\examples\test_batch.bat',
     start_date => sysdate,
     enabled => true,
     comments => 'Run VB Script');
end;
Check if the directory is created and if the file is copied over. Task is to kick off the executable and test is the VBscript within the batch. Challenge is how long the script runs before the next statement in the PL/SQL runs. May be you have to introduce sleep in between.
Note: You must have at least "CREATE JOB" privilege.
Happy coding!
Prakash
Message was edited by:
Prakash Rai

Similar Messages

  • Calling a report from a Stored Procedure

    Is it possible to call a Oracle Report from a Stored Procedure or a Packaged Stored Procedure. If Yes, please provide some details.
    Thanks
    Shalu

    Shalu,
    there's an API available to do this.The feature is called "event driven publishing" (because you can use this even from a trigger) and you can find the documentation here:
    http://download-uk.oracle.com/docs/cd/B14099_17/bi.1012/b14048/pbr_evnt.htm#sthref1870
    Regards
    Rainer

  • Calling external servlet from java stored procedure

    Hello,
    I need to call an external servlet which is in 9iAS server ( unix box) from Java Stored procedure in oracle database.
    Can anybody give me an idea? is it possible?
    Thanks,
    Viswa

    I am trying the same. Here is URL which will help u.
    http://otn.oracle.com/sample_code/tech/java/jsp/samples/wsclient/Readme.html
    Let me know when you run servlet successfully.
    Regards
    Satish

  • Calling Java programs from Oracle Stored Procedure

    Is it possible to call Java programs from Oracle stored procs? If possible Can this be used to exchange data from other applications? Is there a better method/feature in oracle for doing data exchange with other apps?

    If what you mean by Oracle stored procedures is pl/sql then yes.
    You can create a "wrapper" this way:
    CREATE OR REPLACE FUNCTION xmlXform
    in_mapUrl IN VARCHAR2,
    in_inputUrl IN VARCHAR2
    RETURN VARCHAR2
    AS
    LANGUAGE JAVA NAME
    'com.yourcompany.xml2any.xform(java.lang.String,java.lang.String)
    RETURN java.lang.String';
    Then load the java as:
    loadjava -user youruser/youruserpasswd -resolve -verbose lib/xmlparserv2.jar classes/com/yourcompany/xform.class classes/com/yourcompany/xml2any.class
    The java, given the correct permissions, can do anything java can do including communicate with outside applications.
    Is this the "best" way... depends on what you are trying to accomplish.

  • Calling OLE API from Oracle Stored Procedure

    An application that I need to intergate with exposes only the OLE API. How can I invoke these OLE APIs from Oracle stored procedure? Do I need any special/ additional Oracle components? Can you please help. Any links to examples would be very helpful. Thanks.

    If what you mean by Oracle stored procedures is pl/sql then yes.
    You can create a "wrapper" this way:
    CREATE OR REPLACE FUNCTION xmlXform
    in_mapUrl IN VARCHAR2,
    in_inputUrl IN VARCHAR2
    RETURN VARCHAR2
    AS
    LANGUAGE JAVA NAME
    'com.yourcompany.xml2any.xform(java.lang.String,java.lang.String)
    RETURN java.lang.String';
    Then load the java as:
    loadjava -user youruser/youruserpasswd -resolve -verbose lib/xmlparserv2.jar classes/com/yourcompany/xform.class classes/com/yourcompany/xml2any.class
    The java, given the correct permissions, can do anything java can do including communicate with outside applications.
    Is this the "best" way... depends on what you are trying to accomplish.

  • Getting error code 1 when calling SSIS package from a stored procedure (SQL Server 2008 R2)

    Hello,
    I am trying to execute a SSIS package from SQL Server 2008 R2 stored procedure but getting error code 1 (as per my knowledge, error code description is as below:
    0 The package executed successfully.
    1 The package failed.
    3 The package was canceled by the user.
    4 The utility was unable to locate the requested package. The package could not be found.
    5 The utility was unable to load the requested package. The package could not be loaded.
    6 The utility encountered an internal error of syntactic or semantic errors in the command line.
    Details:
    I have a stored procedure named "Execute_SSIS_Package" (see below sp) which executes 'Import_EMS_Response' SSIS package (when I execute this package directly from SQL Server BID it works fine it means package itself is correct) and calling
    it from SQL as:- EXEC Execute_SSIS_Package 'Import_EMS_Response'.
    Here I receives error code 1.
    Can anyone help me to resolve this issue please?
    Thanks in advance!
    CREATE PROCEDURE [dbo].[Execute_SSIS_Package]
     @strPackage nvarchar(100)
    AS
    BEGIN
     -- SET NOCOUNT ON added to prevent extra result sets from
     -- interfering with SELECT statements.
     SET NOCOUNT ON;
     DECLARE @cmd VARCHAR(8000)
     DECLARE @Result int
     DECLARE @Environment VARCHAR(100)
        SELECT @Environment = Waarde
     FROM  Sys_Settings
     WHERE Optie = 'Omgeving'
     --print @Environment
     SET @strPackage = '"\W2250_NGSQLSERVER\BVT\' + @Environment + '\' + @strPackage + '"'
     SET @cmd = 'dtexec /SQL ' + @strPackage +  ' /SERVER "w2250\NGSQLSERVER"  /Decrypt "BVT_SSIS" /CHECKPOINTING OFF /REPORTING E'
     --print @cmd
     EXECUTE @Result = master..xp_cmdshell @cmd, NO_OUTPUT
     --print @Result
    END

    It has something to do with the security.
    E.g. cmdshell is not enabled or the caller has not rights over the package.
    There could be a syntax error, too.
    I suggest you make the package runnable off a SQL Agent job then trigger the job from the stored proc with
    sp_start_job <job name>
    Arthur
    MyBlog
    Twitter

  • Calling Java Constructor from Oracle Stored Procedure

    Hi all,
    I have come across a situation where on insert into one Oracle database instance, a trigger will be fired which will call a procedure which in turn calls a Java constructor with 2 string arguments(The Java class is loaded into another instance of Oracle using Loadjava).
    (Note: I don't want to call a static method from the Oracle procedure)
    I have seen some examples where in using links, on insertion into a table another table of another instance can also be updated.
    for ex: "INSERT INTO testuser.sal_audit@mainlink VALUES (?, ?, ?)" where "mainlink" is a DB link between the 2 instances.
    Similarly is it possble to call the Java constructor loaded in another instance?
    I have tried in this way. It's not working.
    create or replace procedure pr_Cust_object(FeData varchar2,szDummy varchar2) as
    LANGUAGE JAVA NAME
    'CustomObject@mainLink(java.lang.String, java.lang.String)';
    end pr_Cust_object;
    Expecting help at the earliest--ASAP.
    Thanks and Regards,
    Narendra S K

    I don't know how to do that, but I would be interested in knowing how long each insert/update/delete (which ever the trigger fires on) takes.
    And the logic for rollbacks is probably really interesting.

  • Call a function inside a package from a stored procedure

    Hello:
    I am kind of new to the stored procedure. Does anyone know how to call a function inside a package from another stored procedure?
    I have a existing function (func_b) inside a package (pack_a) and it returns a cursor. I want to call this function from a stored procedure (proc_c) so that I use the data inside the cursor.
    can I do the following in proc_c:
    my_cursor1 SYS_REFCURSOR;
    begin
    my_cursor1 := exec pack_a.func_b
    end
    It will be very helpful if anyone can point me to any reading or example. Thank you very much for your information.

    guys:
    Thank you for your information so far. I need some more help here. I was able to run the function in my stored procedure. However, I was not able to print the result on the screen to view the cursor result, although I am using dbms_output.put_line statement inside my stored procedure.
    I use the following statement to execute my stored procedure on sql*plus. I can tell the stored procedure is executed successfully, but I did see anything printed:
    DECLARE TEMP VARCHAR2(100);
    BEGIN PROC_LAWS_CAD_NAME_SEARCH('LPD', 'TEST DEVICE ID', 'TEST LAST NAME', 'TEST FIRST NAME', 'F', '11112009', TEMP); END;
    I tried to use 'set serveroutput on' and got the following error:
    ERROR:
    ORA-06502: PL/SQL: numeric or value error: host bind array too small
    ORA-06512: at line 1
    I am kind of confused now. thank you for your help.
    Jack
    Here is my procedure:
    create or replace
    PROCEDURE PROC_SEARCH
    ( AGENCY_ID IN VARCHAR2,
    DEVICE_ID IN VARCHAR2,
    L_NAME IN VARCHAR2,
    F_NAME IN VARCHAR2,
    SEX IN VARCHAR2,
    DOB IN VARCHAR2,
    CAD_NAME_SCH_RESULT_STR OUT VARCHAR2)
    AS
    v_agy_id varchar2(10);
    v_device_id varchar2(20);
    v_l_name varchar2(25);
    v_f_name varchar2(15);
    v_sex varchar2(1);
    v_dob date;
    -- this cursor is going to be used to store a list of warrant matching
    -- name search criteria
    cad_srch_cursor sys_refcursor;
    objSrch SEARCH_RESULT_TEMP%ROWTYPE;
    BEGIN
    cad_srch_cursor := SEARCH_PKG.SEARCH('TESTING', 'TESTER', null, null,null, null, getPhonetic('TESTING'));
    LOOP
    FETCH cad_srch_cursor INTO objSrch;
    EXIT WHEN cad_srch_cursor%NOTFOUND;
    --insert into SEARCH_RESULT_TEMP (name_last) values (objSrch.name_last);
    CAD_NAME_SCH_RESULT_STR := objSrch.name_last;
    dbms_output.put_line('First:'||objSrch.name_first||':Last:'||objSrch.name_last||':Middle:'||objSrch.name_middle);
    end LOOP;
    END PROC_LAWS_SEARCH;
    -----------------------------------------

  • How to call EJB deployed on OC4J from java stored procedure?

    Hello,
    I'd like to call EJB from java stored procedure. My example works fine from command line, but the problem seems to be with deployment of this code into database. Especialy I'm wondering how to reference jars like oc4jclient.jar, ejb.jar, ... from java stored procedure.
    Is there some example how to do that ?
    Can You help me please ?
    Many thanks,
    Radim Kolek,
    Eurotel Prague.

    Hi,
    You may want to check up this thread
    Calling JBoss EJBs from Java stored procedure
    Hope this helps,
    Sujatha.
    OTN Group.

  • Calling stored procedure from a stored procedure

    I have a stored procedure that accepts a customer prefix like "abc" and returns a customer document number like "abc-0021". (Thanks V Garcia)
    This sp works when I call it from SQL Plus Worksheet.
    But I need to call it from another stored procedure and store it in a local variable so that I can insert it into a table with the rest of the information.
    This is what I have tried so far:
    CREATE OR REPLACE  PROCEDURE "SCHEMANAME"."SP_XXTESTXX" ( seq_name in
        varchar2)
    AS
          id_out varchar(10);
    BEGIN
       execute SP_GET_NEXT_DOC_NUMBER(seq_name,:id_out);
       print id_out;
    END;but this will not compile. I get this error:
    Line # = 8 Column # = 12 Error Text = PLS-00103: Encountered the symbol "SP_GET_NEXT_DOC_NUMBER" when expecting one of the following:     := . ( @ % ; immediate The symbol ":=" was substituted for "SP_GET_NEXT_DOC_NUMBER" to continue.
    Line # = 8 Column # = 41 Error Text = PLS-00049: bad bind variable 'ID_OUT'
    Line # = 10 Column # = 10 Error Text = PLS-00103: Encountered the symbol "ID_OUT" when expecting one of the following:     := . ( @ % ; The symbol ":=" was substituted for "ID_OUT" to continue.

    I think I got it.
    CREATE OR REPLACE  PROCEDURE "SCHEMANAME"."SP_XXTESTXX" ( seq_name in
        varchar2)
    AS
      id_out varchar(10);
    BEGIN
      SP_GET_NEXT_DOC_NUMBER(seq_name,id_out);
      dbms_output.put_line(id_out);
    END;This works like I wanted it to do.

  • How do I get return parameters from a stored procedure call?

    The Open SQL Statement has an option on the Advanced tab to specify a command type of 'stored procedure'. In addition to returning a recordset, a stored procedure can also return parameters (see http://support.microsoft.com/support/kb/articles/Q185/1/25.ASP for info on doing this with ADO). Is it possible to get those return parameters with TestStand? In particular, I want to be able to get error codes back from the stored procedure in case it fails (maybe there is another way).

    The Open SQL Statement step type does not fully support stored procedures. If the procedure returns a record set than you can fetch the values as you would a SELECT statement. Stored procedures require you to setup the parameters before the call and this is not yet supported. Bob, in his answer, made a reference to the Statements tab and I think that he was talking about the Database Logging feature in TS 2.0.
    If the stored procedure is returning a return value, it may return as a single column, single row recordset which can be fetched as you normally do a record set.
    Scott Richardson
    National Instruments

  • Need to call an Oracle Form from a stored procedure, any suggestions.

    I have a stored procedure which runs on our 8i database on a scheduled basis. I have an Oracle Form (6i) that needs to be called automatically from this stored procedure. Any suggestions on how I might accomplish this?
    Thanks,
    Wes

    You might be able to do this using a java stored procedure. I think you need to have version 8.1.6 or above to java stored procedures. Here's a couple of links that might help.
    http://asktom.oracle.com/pls/ask/f?p=4950:8:4044562665234829894::NO::F4950_P8_DISPLAYID,F4950_P8_CRITERIA:952229840241,
    http://asktom.oracle.com/pls/ask/f?p=4950:8:4044562665234829894::NO::F4950_P8_DISPLAYID,F4950_P8_CRITERIA:3618360089466,

  • Execution Times of Stored Procedures Called from Other Stored Procedures

    If I execute sys.dm_exec_procedure_stats, it will produce execution times of my stored procedures executed recently.
    However, stored procedures called from other stored procedures do not show up.
    Is there code that can return the execution times of stored procedures even though they are called from other stored procedures.

    Look at the example. It is counting nested execution.
    CREATE PROC z1SP AS SELECT * FROM Production.Product;
    GO
    CREATE PROC z2SP AS SELECT * FROM Production.Product WHERE Color is not null; EXEC z1SP;
    GO
    SELECT object_name(2002822197), object_name(2034822311);
    --z1SP z2SP
    EXEC z1SP; EXEC z2SP;
    GO 10
    SELECT * from sys.dm_exec_procedure_stats
    database_id object_id type type_desc cached_time last_execution_time execution_count
    16 2002822197 P SQL_STORED_PROCEDURE 2014-12-16 13:02:45.170 2014-12-16 13:02:46.717 20
    16 2034822311 P SQL_STORED_PROCEDURE 2014-12-16 13:02:45.460 2014-12-16 13:02:46.687 10
    Kalman Toth Database & OLAP Architect
    SQL Server 2014 Database Design
    New Book / Kindle: Beginner Database Design & SQL Programming Using Microsoft SQL Server 2014

  • Running ".sh" file from a stored procedure

    Hi,
    I need to call a file.sh linux bat file whit arguments from a stored procedure.
    How can I do?
    Thanks in advance...

    Hi rajni,
    I've tryed your solution but it doesn't work, for the same reason that yuo can see here:
    Re: questions about dbms_scheduler.create_job (ORA-27371)
    I've also tryed the solution of the "user534897", but it doesn't work too.
    At execution time Oracle give me this error:
    ORA-29540: class djv_osCommand does not exist
    ORA-06512: at "CICCSV.DPK_OSCOMMAND", line 5
    ORA-06512: at "CICCSV.DPK_OSCOMMAND", line 28
    ORA-06512: at "CICCSV.DFN_mkdir", line 5
    ORA-06512: at line 8
    If you have any other idea or suggestion you're welcome. At the moment I've no solution for my problem.
    Thanks in advance.

  • Returning a table from a stored procedure

    hi, i need to return a table from a stored procedure and show it, and come to this, but a don't know hoy to run it, so i don't know if it is right, can anyone help me?
    uTable out objects_uptime%rowtype
    as
    begin
    select * into uTable from objects_uptime;
    end;

    well, i finally discovered how to do the trick
    this is the code for the function:
    CREATE OR REPLACE FUNCTION FN_GET_RECORDS RETURN UPTIME PIPELINED IS
    CURSOR cUptime is select * from objects_uptime;
    p refcur.refcur_t;
    temp p%ROWTYPE;
    temp2 OUPTIME := OUPTIME(null, null, null, null, null, null, null, null, null);
    BEGIN
    OPEN cUptime;
    LOOP
    FETCH cUptime into temp;
    temp2.OBJ_NAME := temp.OBJ_NAME;
    temp2.IP := temp.IP;
    temp2.STATUS := temp.STATUS;
    temp2.DOE := temp.DOE;
    temp2.ENABLED := temp.ENABLED;
    temp2.COMMENT00000 := temp.COMMENT00000;
    temp2.USERID := temp.USERID;
    temp2.OBJECTID := temp.OBJECTID;
    temp2.MNTID := temp.MNTID;
    pipe row(temp2);
    EXIT WHEN cUptime%NOTFOUND;
    END LOOP;
    RETURN;
    END FN_GET_RECORDS;
    and this for the auxiliar package, object and table:
    CREATE OR REPLACE PACKAGE REFCUR
    as
    TYPE refcur_t IS REF CURSOR RETURN objects_uptime%ROWTYPE;
    end REFCUR;
    CREATE OR REPLACE TYPE OUPTIME AS OBJECT ( "OBJ_NAME"
    VARCHAR2(255), "IP" VARCHAR2(20), "STATUS" VARCHAR2(10),
    "DOE" DATE, "ENABLED" NUMBER(10, 1), "COMMENT00000"
    VARCHAR2(1000), "USERID" VARCHAR2(50), "OBJECTID" NUMBER(10,
    1), "MNTID" NUMBER(10, 1) )
    CREATE TYPE TUPTIME AS
    TABLE OF OUPTIME
    i call it this way:
    select * from table(FN_GET_RECORDS ())
    if anyone knows how to do the same in a shorter manner, tell me please.
    thanks to everybody for the help.

Maybe you are looking for

  • How do we send document from one group to other through sharepoint designer??

    Hi SharePointers, Looking for help.. Requirement: I have 3 groups 1.requestors 2. Approvers 3. Vendors. In Requestor group, there are so many Requestors and every Requestor logged in to subsite and  create a new document in the same DocHub. But No Re

  • How can I get a CD Rom to open on my Mac?

    I have a CD Rom on which is sign language lessons, but everytime I put it in my Mac it will open so that I can see the various files on the disc, but when I click install it opens a new window and it says "requires Microsoft Windows to install this p

  • BSIS/BSAS tables not populated

    Dear Experts, I have a GL/account having too many items but FAGLL03 returns no items. I have found that the reason is that tables BSIS and BSAS are not being populated with line items. however tables BKPF and BSEG in addition to FAGLFLEXA are all pop

  • Images Missing on Aperture

    I have Aperture on an external drive. I was working on aperture, and then it said it had to rebuild my library. While rebuilding, my hard drive came unplugged and now only a few of my photos are on there. The titles of all my folders are there, but t

  • Passing Multiple Checkbox Values Help

    Brand new to Coldfusion and I'm struggling to figure out how to pass values from multiple checkboxes on a form to a confirmation page and then an action page that inserts the data. The confirmation page will simply show their selections and allow the