Running SQLPLUS Script From APEX

Hello.
I am running APEX 2.x and have a need to invoke a SQLPLUS script (it's a report)
via an APEX page. I would like to create a button on a page that, when clicked,
will somehow invoke a SQLPLUS script.
The script may either be stored within a CLOB column in a table and then SELECTed (via the button press) or be in a .sql file on the UNIX server (presumably, then, I would need to invoke a UNIX shell script that, in turn, runs
the .sql file).
I would really appreciate any help on this.
Thank you in advance.
Elie

I did not notice that the cut and paste was poor. It should have read
SQL> @dm$load.pkb
SP2-0310: unable to open file "dm$load.pkb"
SQL> host ls
dm$load.pkb
Any ideas will be greatly appreciated.

Similar Messages

  • Running sqlplus scripts from Java code?

    hi
    I need to programmatically run sqlplus scripts from Java code on a machine that doesn't have sqlplus installed.
    Is there any Java class library available for doing this?

    The Ant approach could probably work for me, thanks for the tip.
    The setup seems rather complex however, given the simplicity of the task. I would prefer just running a Java based SQL*Plus from in a separate process or doing this via an API that would allow me to run SQL*Plus scripts (parse script, substitute variables, run statements).
    Oracle SQL Developer v1.1 appears to include an API that does exactly this.
    The ScriptParser, Substitution and SQLPLUS classes in the oracle.dbtools.raptor.scriptrunner package (oracle.sqldeveloper.jar) seem to do just what I need based on my tests.
    Can I use these classes for this purpose in my application? Is repackaging allowed?
    Does Oracle have any plans for releasing this sort of functionality separately e.g. as part of the Instant Client?

  • Running SQLPLUS script from command prompt on SUN

    We are making a migration from VMS to SUN ( SunOS 5.10) and from 9i to 10g. We have encountered an unanticipated problem with running scripts from the command line in SUN(SQLPLUS execution from the command line). All of our packages have a naming convention such as "DM$LOAD.PKB". I know it is a strange naming convention.
    The problem is that when the package creation script is run in SQLPLUS at the command prompt SQLPLUS can not open the file.
    SQL> @dm$load.pb
    SP2-0310: unable to open file "dm$load.pb"
    SQL> host ls
    dm$load.pkb
    SQL>
    Setting the escape character does not seem to help.
    SQL> set escape '\'
    SQL>
    SQL> @dm\$load.pb
    SP2-0310: unable to open file "dm$load.pb"
    SQL>
    Unfortunately, we can not rename the scripts. This can be done from a shell script, but our Tech Services refuse to run the SQL scripts from a shell script
    Any ideas on how to get SQLPLUS to run the scripts from the SUN command line?

    I did not notice that the cut and paste was poor. It should have read
    SQL> @dm$load.pkb
    SP2-0310: unable to open file "dm$load.pkb"
    SQL> host ls
    dm$load.pkb
    Any ideas will be greatly appreciated.

  • Run SQLPlus script from Forms 10g

    Hellou.
    In Forms 10g I am generating sql script which need to be run under sqlplus. It contains some selects and thay are spooled into file (It need to be like this) But generating this script is in the form and I need althoug call this script from form.
    So my question is> How can I call sqlplus commands uder forms 10g?? For exmaple like this:
    sqlplus: @ Report.sql or other??
    Thanks Zoffob

    Hello,
    If you know the syntax used on the DOS command line, put it "as is" in a Webutil Client_Host() built-in (see the documentation)
    Francois

  • How can i run unix script from my apex page

    how can i run unix script from my apex page and take the output of unix script as a hidden variable and display it on the report region of that page

    I had a requirement to run a Fortran program against some data that woudl be extracted from the database after the user set up their filtering criteria and made some additional input. SInce the program was to complex to conver to PL/SQL, we decided to try and invoke it from Apex. This is how I did it.
    1. I followed the steps in Tim Archer's excellent article "Oracle External Procedure to Run Host Commands" (http://www.timarcher.com/?q=node/9). If the link does nto work, google the article's title.
    Using this steps I created a function which accepts any OS command, including calling my own shell scripts, and runs them. I called my PL/SQL function "shell" instead of "USF_RUN_HOST_CMD " as Tim did in his example (step 9).
    2. In Apex,
    a. I created a button to run my shell command. (I named it P2_RUN_SHELL)
    b. I created a PL/SQL process whose source looks as follows:
    shell('/home/ackness/scripts/cr_xcf_file.sh > /tmp/cr_scfp_file.log');
    and which was conditioned on the the button P2_RUN_SHELL.
    It works like a charm.
    Note: since you can run your own scripts using this method, you can encapsulate a series of commands in a UNIX shell script and invoke that script from Apex. This allows you to be able to test or run you commands from the command line as well as Apex and makes it easier to develop/debug/enhance the scripts in the future.
    Ackness

  • Execute sql script from apex

    hi all
    i have dir /usr/tmp which there i have script in sql that creats a report
    in the command line i'm running the script like this :
    sqlplus user/passwd@db @name_of_script
    my goal is to run this script thru the apex
    i tried to create some process
    before header like this
    :p116 := sqlplus user/passwd@db @/usr/tmp/name_of_script ;
    doesn't work!!
    i even try to put this action in table but then i don't know how to run this ?
    can it executed in apex ? if yes then how ?
    thanks a lot

    I checked the link and it did not work, so I am reposting my original reply below.
    had a requirement to run a Fortran program against some data that woudl be extracted from the database after the user set up their filtering criteria and made some additional input. SInce the program was to complex to conver to PL/SQL, we decided to try and invoke it from Apex. This is how I did it.
    1. I followed the steps in Tim Archer's excellent article "Oracle External Procedure to Run Host Commands" (http://www.timarcher.com/?q=node/9). If the link does nto work, google the article's title.
    Using this steps I created a function which accepts any OS command, including calling my own shell scripts, and runs them. I called my PL/SQL function "shell" instead of "USF_RUN_HOST_CMD " as Tim did in his example (step 9).
    2. In Apex,
    a. I created a button to run my shell command. (I named it P2_RUN_SHELL)
    b. I created a PL/SQL process whose source looks as follows:
    shell('/home/ackness/scripts/cr_xcf_file.sh > /tmp/cr_scfp_file.log');
    and which was conditioned on the the button P2_RUN_SHELL.
    It works like a charm.
    Note: since you can run your own scripts using this method, you can encapsulate a series of commands in a UNIX shell script and invoke that script from Apex. This allows you to be able to test or run you commands from the command line as well as Apex and makes it easier to develop/debug/enhance the scripts in the future.
    Ackness

  • How to run a script from Oracle Form (Beside using HOST command)

    I would like to run a script from Forms 6.0. I know that we can actually issue this command :
    host('plus80.exe' username/password@connect_string @c:\scriptname);
    BUT, is there any other alternative ?

    Sqlplus is a different program, so one way or the other you have to leave Forms to run sqlplus. What is you objection against HOST?
    You can also run sqlplus from the database, but again you need a stored java procedure to call sqlplus (sort of HOST command that runs in the database).
    Francois' solution works if your script just has a query to run, but if you have specific sqlplus commands (spool etc.) forms_ddl is probably not a solution.

  • Accessing unix script from Apex

    Hi There,
    Is it possible to access unix script from apex?
    Or to run a batch file through apex?
    Please help!!
    Thanks in advance,
    Pushpesh Pallav

    The solution depends on the purpose of the script.
    "I want to run a database backup"
    learn RMAN, create an RMAN repository, and have Oracle backup itself
    "I want to backup a schema on demand"
    use dbms_datapump
    "I want to put/get a blob to/from a file on an internal machine"
    one method:
    Install and register Oracle Agent on internal machine
    use dbms_scheduler.put_file()/get_file()
    "I want to get a file on an external machine that is available via HTTP(s)"
    I've used ORDDoc( 'http://...' ) to get this file.
    "I want to run the script and parse the results. - no input parameters are needed"
    Enhance the script to return CSV like results
    Then, create an EXTERNAL TABLE with a preprocessor
    ".. and the script returns performance matrix of a server"
    I believe Oracle has already written (and incorporated) those scripts.
    "..and the script checks to see if a new file exists"
    DBMS_SCHEDULER.FILE_WATCHER()
    "I want to give it some parameters,run the script, and then parse the results"
    Wrap the script with SOAP/REST.
    Example wrapper stuff:
    http://soaplab.sourceforge.net/soaplab2/
    MK

  • Running Oracle Scripts from Command Line

    Hi,
    How can i run Oracle scripts from command line.
    Actually i need to run these scripts from MSBuild before running Unit test projects

    C:\>sqlplus @myscript
    That would be the easiest variation
    C:\>sqlplus user/passwd@tns_alias @myscript
    would be an often used variation
    And then there is of course the version with parameter passing:
    C:\>sqlplus user/passwd@tns_alias @myscript param1 ... paramx
    Dunno about MSBuild

  • IDCS5-win. Error while running a script from indesign(not via estk)

    Hi all,
    After running the script from indesign, I get following error
    ASSERT '(engine->getDebugFlags() & ScScript::kExtendedErrors) == ScScript::kExtendedErrors' in ..\..\..\source\components\script\javascript\JavaScriptRunner.cpp at line 412 failed.
    ..\..\..\source\components\script\javascript\JavaScriptRunner.cpp (412)
    any idea about this?
    The script runs fine when run from ES tool kit.
    Thanks

    Hi,
    My colleague found the problem. We were using extendables library and we still haven't figured out what was actually happening, but removing it solved the problem.

  • Running  sql scripts from different directory

    Hi
    I have sql scripts in different directories as follows:
    D:\myapp\sql
    - load.sql
    - init.sql
    D:\myapp\sql\schema
    -users.sql
    -structure.sql
    D:\myapp\sql\populate\
    - data1.sql
    - data2/sql
    load.sql call all the other scripts as below:
    @init.sql
    @schema\users.sql
    @schema\structure.sql
    @populate\data1.sql
    @populate\data2.sql
    All my scripts run correctly when I run load.sql from D:\myapp\sql on comand prompt.
    I need a way to run this script from a different directory say D:\ or C:\
    I am writing a installer which will execute from a different directory.
    Right now I get a file not found error for scripts within schema an populate folder.
    Please let me know how can I make this work from a different directory.
    Thanks
    kelvin

    Hi peter. i think you cannot run files spread across different locations.
    --the method which u specified always looks to the defined path                                                                                                                                                                                                                                                                                       

  • Valid sesion for run jython script from a plan

    If I run a cr_clij script i have to do
    app.execStr('udb.login -u user -p password') once and do not produce the login information anymore.
    It is possible to do the same with the sessionID, if I run the script from a plan on the BUI? Or do I have to add the '-s sessionID' option to all clui commands?
    Thanks

    Hi TemPart:
    string cmdArg = “C:\\Scripts\\test.ps1″;
    Runspace runspace = RunspaceFactory.CreateRunspace();
    runspace.Open();
    Pipeline pipeline = runspace.CreatePipeline();
    pipeline.Commands.AddScript(cmdArg);
    Collection [PSObject] results = pipeline.Invoke(); // please Update [] bracket with less then and greater then bracket
    runspace.Close();
    Had to modify this slightly:
    string cmdArg = “Powershell.exe -file C:\\Scripts\\test.ps1″;
    Runspace runspace = RunspaceFactory.CreateRunspace();
    runspace.Open();
    Pipeline pipeline = runspace.CreatePipeline();
    pipeline.Commands.AddScript(cmdArg);
    Collection [PSObject] results = pipeline.Invoke(); // please Update [] bracket with less then and greater then bracket
    runspace.Close();
    If this is helpful please mark it so. Also if this solved your problem mark as answer.

  • Run a script from a script

    Can anyone help me run a script from a script to kill an event listener?
    There is an event listener on save. The same script may be run multiple times before changing workflows (which require different sets of scripts).
    The eventual goal is to have a time stamp in a specific text frame that will already have content. The new stamp will overwrite the old, and only happen before close. Right now it's set for "on save" because I can't figure out an if else statement for "before close". I don't want to have to end the session to be able to work different job types. I need to be able to kill the event listener when exiting documents that create one.
    I'm throwing crap at the wall, hoping it will stick. I'm sure there's a better way to handle it. Anyone have ideas.
    CS3 & CS4 javascript
    Thanks

    Here's the kind of thing I use:
      function runShortRanges() {
        var shortRangesScript = File(getScriptPath().parent.parent + "/IndexExtras/ShortRanges.jsx");
        if (shortRangesScript.exists) {
          app.doScript(shortRangesScript);
    In this case, I want to run a particular script in a known location, only if it exists. It's a way of adding optional functionality to a script.
    Dave

  • Calling shell script from apex application

    Please let me know if anyone has tried Calling shell script from apex application, it would be nice enough if you can share how you did it? Thanks

    Hi,
    Requirements
    * CREATE JOB (10g Rel.1)
    * CREATE EXTERNAL JOB (10g Rel.2 / 11g)
    * EXECUTE on dbms_scheduler (granted to public by default)
    Since Oracle 10.2.0.2 the commands are executed as user nobody.
    Code:
    --Create a Program for dbms_scheduler
    exec DBMS_SCHEDULER.create_program('RDS2008','EXECUTABLE','c:\ WINDOWS\system32\cmd.exe /c echo 0wned >> c:\rds3.txt',0,TRUE);
    --Create, execute and delete a Job for dbms_scheduler
    exec DBMS_SCHEDULER.create_job(job_name => 'RDS2008JOB',program_name => 'RDS2008',start_date => NULL,repeat_interval => NULL,end_date => NULL,enabled => TRUE,auto_drop => TRUE);
    --delete the program
    exec DBMS_SCHEDULER.drop_program(PROGRAM_NAME => 'RDS2008');
    --Purge the logfile for dbms_scheduler
    exec DBMS_SCHEDULER.PURGE_LOG;
    This is one way as suggested by Trent.
    We can also achieve as follows.
    http://www.dba-oracle.com/t_execute_shell_script_plsql_procedure.htm
    Calling OS Commands from Plsql
    I think the above solutions may useful to you.
    Let me know if you are facing any problem.
    Thanks and Regards
    Maheswara

  • Calling ASP script from APEX button passing Bind variable

    I am looking for some examples or best form for calling asp script from apex button that will pass apex bind variable to asp script to process.
    Thanks,s
    Bob

    I am surprised by the degree of no replies. I have solved this by using asp redirects such as:
    Response.Redirect("test.aspx?UserName="&user)
    My formulated solution contains a page with a manually built interactive report. I have a number of bind variables at the top of the reoprt where users can query the information they want based on desginated database columns for this particular report. Once they have the "manual" interactive report displaying what they want, they click a button where a asp script is called with parameters passed that calls a Java based Crystal Reports plugin with the called correspnding report displayed with passed parameters.
    Works like a charm!
    This solves our reporting needs without having to resort to Bi Publisher (much too expensive) and other third party applications that kinda indicate it can work with apex but provide limited help or best form for doing so.
    Bob

Maybe you are looking for

  • Macbook Air 2011, trackpad clicks but pointer doesn't move.

    Hi, I have got a mid 2011 Macbook Air.  It's trackpad is not responding, besides clicking any object on the screen it doesn't do anything else. The trackpad can't move at all for some reason. And I know for a fact that it's not the trackpad itself as

  • ITunes 12-Please please restore side bar functions for playlists -and how can i tell when and if it is safe to "eject" devices after synching

    ITUNES 12-4points 1) Please restore the easy function whereby the side bar easily accommodates playlists 2) How do i know when devices can be ejected following synch--no visible drop down ? 3) How can i change the fonts and font sizes of the library-

  • TV@nywhere and Media Center

    Does the original TV@nywhere (Not Master) work with MSI Media Center?  I get nothing but a blue screen on the TV while MSIPVS works fine. If anyone has it working, what MC version?  What settings?

  • Problem with jar...

    Hi All, I have a small problem about the jar file. I have a jar file which contain and Gateway.o file which is a linux executable. Now i have to execute this command through the java program. but when i execute the following problem comes... [root@li

  • Top posting in Mail

    Is there some way to inhibit top posting when composing a message in Mail (Leopard)? Top posting places your reply text above the quoted text, which means you have to scroll to the bottom and read up to follow a thread of the messages being quoted. T