Need help, executing a SQL file from Forms

Hi everyone,
I don't know if this can be done. I want to execute a SQL file from a When-Button-Pressed trigger. I checked a couple of place but havent found anything yet on how to do this. If someone know of a way, please help.
Thanks
Eric

procedure p_call_sqlplus is
   l_filename varchar2 (1000) := 'C:\abc\def\test.sql'  ;
begin
   host ('sqlplus /NOLOG @' ||  l_filename ) ;
end ;
rem ======== test.sql ========
connect scott/tiger
spool 'C:\abc\def\test'
select * from emp ;
spool off
exit
rem ======================working on the machine where forms is running

Similar Messages

  • Execute sql file from forms

    Hello, how is it possible to execute a sql file from forms without using sqlplus, because we have only the forms runtime on our pc.
    We can't use forms_ddl because we have a very big sql script for creating a package.
    Please help,
    GJ

    Strange, whenever I have installed forms I got sqlplus too without asking for it. If it is not installed, wouldn't your best bet be to install it ?

  • How to execute a  .sql file from a batch file

    Hi all
    I've to take backup of a database weekly twice on every wednesday & Friday @ 5pm IST. I've written a hot backup script, which works every well.
    now i want to automate the script. ie i want this script to run on wednesday & friday @ 5pm without any human interfearance ie with out actually any1 executing this script.
    i created a batch file prod.bak with the following lines
    @echo off
    set oracle_sid=testdb
    set oracle_home=d:\oracle\ora92
    sqlplus /nolog
    connect sys as sysdba/oracletest@testdb
    this batch file when eexecuted connects me to sql prompt.
    Now i want to execute my backup script bkp.sql automatically when it is connected to sql prompt.
    (i tried with these lines in the above batch file...
    call bkp.sql---it just opens the bkp.sql file in notepad & displays the script
    start bkp.sql---same as call
    connect / as sysdba/pwd@[email protected] --- does not work simply remains a the sql prompt.
    At 17:00 /Every:w,f "d:\bkp.sql"---does not work simply remains at the sql promt.)
    Can any1 let me know what should i write in the batch file that will execute the bkp.sql file automatically after it gets connected to sql prompt. M using oracle 9i.
    I'll manage he time through windows utility of scheduling task.. Let me know how to execute the .sql file from a batch file.
    Thanks
    Tripti

    Try
    sqlplus "sys/oracletest as sysdba" @bpk.sql
    Working locally, and having set the ORACLE_SID, you don't need to specify the SqlNet alias (@testdb).
    Remember to put an exit at the end of the bpk.sql script.

  • Need help on Dynamic SQL Cursor in Forms

    Hi All,
    I am trying to execute Dynamic SQL Cursor in forms using EXEC_SQL built in.
    I have a cursor for example:
    'select * from supplier where supplier = '||p_supplier||' and processing_order = '||p_order
    My code is
    cur_num := Exec_SQL.Open_cursor;
    sql_order := 'select * from supplier where supplier = '||p_supplier||' and processing_order = '||p_order;
    EXEC_SQL.PARSE(cursor_number, sql_order);
      EXEC_SQL.DEFINE_COLUMN(cur_num ,1,ln_Supp_Id);
      EXEC_SQL.DEFINE_COLUMN(cur_num ,2,ls_Suppl_Name,30);
    EXEC_SQL.DEFINE_COLUMN(cur_num ,24,ls_exchange,20);
      sql_count := EXEC_SQL.EXECUTE(cur_num );
      While EXEC_SQL.FETCH_ROWS(cur_num ) > 0 Loop
            EXEC_SQL.COLUMN_VALUE(cur_num ,1,ln_Supp_Id);
            EXEC_SQL.COLUMN_VALUE(cur_num ,2,ls_Suppl_Name);
            EXEC_SQL.COLUMN_VALUE(cur_num ,24,ls_exchange);
    End Loop;
    EXEC_SQL.CLOSE_CURSOR(cur_num );
    In this case I have to write 24 Define Columns and 24 Column value. Is there any way to assign them to %rowtype at one time as I need all coulmn of the table.
    I had similar case on multiple tables.
    Please help me
    Thanks,
    Maddy

    I need this dynamic sql because p_supplier and p_order values changes at run time
    I do not understand. Is this a simplified sample or the real thing? You do know that you can pass variables to cursors:
    cursor test is
    select * from supplier where supplier = p_supplier and processing_order = p_order;
    or does e.g. p_supplier hold other parts of the query?
    cheers

  • How to execute Pro*C file from form

    Hi All !
    I have one pro*c file(.pc & .exe) . How I can execute this file from form.
    Regards,
    Neeraj

    I think you could use Ora_Ffi package too. Make sure that you use correct version of Pro/C.
    I think you should use Pro/C version 8.0.x with Forms 6.0. I don't use Forms 6i, but I think it is the same for it too.

  • Need help to run sql loader from Form6i

    Hi All,
    I have some problem with the sql loader running from form 6i.
    I have done following steps for that.
    1. have created bat file to run sql loader.
    2.Alos created ctl and txt files inside the same folder.
    In the form , in button press i have written below code
    HOST('cmd /c C:\load1.bat > C:\output.txt');
    But it is giving error as -
    "Unable to open Load1.ctl."
    but i have run that bat files from command prompt ; and it is running fine.
    I guess probably it is not getting the correct path.
    Will pls help me, wt exacly I'm doing wrong?
    Rg,
    Subir

    Hi Francois,
    Thanks for reply.
    It is not a problem with the batch files. Coz, I just able to run batch files, but that is not correct solution.
    Once the host command id firing, that time it is going to path -
    "c:\orant\Form60\"
    And in this path it searching for that batch files and all the require files; but the require files are present in some different folder. So i think I need to change the path as well, but that I'm unable to do.
    To resolve the problem, I have copied all the files in "c:\orant\Form60\" folder, and then it is working.
    So I think I need to changed the path, so how to change the path. If I able to change the path I think it will worked. How to change the path?
    Best Rg,
    Subir

  • Need Help: Have to route file from directory to directory in same system

    Hi Experts,
    I need to route xml file from one directory to another and then to another one in the local system. For example, i have the file in directory A, i need to delete that file from that location and place it in B and then from B i have to move it to A again and then move it to C.
    The path will be:     A-> B -> A -> C
    where A, B, C are folder names
    How can i do that in SAP-XI in ID? Do i need to create two communication channels? Please guide me and help me out of this.

    Hi Arkesh,
    >>For example, i have the file in directory A, i need to delete that file from that location and place it in B and then from B i have to move it to A again and then move it to C.
    For doing this why you need SAP PI? you can better do this with a script or batch job.
    >>A-> B -> A -> C
    A to B will be one interface and B-->A will be another one. The file getting picked from A and getting dropped to A (in second scenrio) shoudl not have the same name else these two interfaces will go in a loop.
    A to C will be the third scenario
    each scenario will have a sender file adapter and a receiver file adapter.
    But still I didn't get the business usage or usage of PI in this case
    Regards
    Suraj

  • Need help with managing .mts files from Canon XA-10

    I capture a lot of lectures and other long events.  As such, I need to import my files and then put them into the Premiere Pro CC timeline in order but when I do, it looks like they're skipping a frame when arranged chronologically.  Usually I find the footage on the camera through the Media Browser and then bring that one big file into the timeline and export it that way.  This process takes FOREVER.  I'd prefer to be able to copy the individual 2GB .mts files and add them to my timeline.  Any ideas or solutions out there?

    Ok, so, perhaps explaining my workflow in detail would help better address my problem:
    1. record lecture, let's say 1 hour
         That will make around 5 2GB .mts files on the Canon XA-10 Built-in Memory(64GB)
    2. connect camera via USB 3.0 port to computer and create a new PP project for this lecture
    3. through the Media Browser tab, I locate the file on the camera and drop it into the timeline of the new project
    4. wait for the file to conform(depending on the length of the file, could take many minutes, sometimes an hour)
    5. after conforming, I export the file in it's entirety to it's appropriate project folder on the computer(this will take at least as long as the file length, most times longer).  On the export screen, I check the box to import file into project upon completion.
    As you can see, importing my tapeless assets from the camera can take up to an hour and a half, sometimes longer, before I am able to start editing them.  Obviously, when I simply copy the 2GB .mts files from the camera to a project folder through Finder or Windows Explorer, it takes a considerably less amount of time.  The problem I then encounter is that when I then try to place them into the PP project timeline as individual files, they appear to skip frames at their edit points, or about every 11.5 minutes.  I just tired JSS1138's idea and I get the same problem as before.

  • Need help in compling sql file

    Hi,
    I am having around 20 sql files (20 different proc/functions) and I am changing almost all the sql files frequently, for compiling everytime I am executing
    SQL> @1.sql
    SQL> @2.sql
    SQL> @20.sql
    Its there anyway to compile all the sql's in one shot.
    Thanks

    Step 1: save all source code in c:\
    step 2 : Create file main.sql in c:\
    /*main.sql file*/
    Spool C:\temp\sql\pkg_installation_errors.log
    prompt #compliing package 1;
    @@C:\1.sql;
    show errors;
    prompt #compliing package 2;
    @@C:\2.sql;
    show errors;
    prompt #compliing Porcedure3;
    @@C:\3.sql;
    show errors;
    prompt #compliing Function 4;
    @@C:\4.sql;
    show errors;
    prompt #compliing package 5;
    @@C:\5.sql;
    show errors;
    prompt #compliing package 6;
    @@C:\6.sql;
    show errors;
    spool off;
    step 3: \ run it from sqlplus
    It wil work

  • Executing multipule .sql files in Sequence

    Hi ,
    I am new to oracle world . I need to execute 150 .sql files from my local machine . I am trying do something like this ...
    but facing many errors ... I am using oracle 10 g
    Please advice me .
    CREATE OR REPLACE PROCEDURE MYPROC AS
    BEGIN
    DECLARE
    CNT NUMBER :=0;
         @c:\sql\1.sql;
    CNT:=CNT+1;
    @c:\sql\2.sql;
         CNT:=CNT+1;
         commit;
    EXCEPTION
    BEGIN
         ROLLBACK;
         DBMS_OUTPUT.PUT_LINE('TRANSACTION ROLLEDBACK')
         DBMS_OUTPUT.PUT_LINE('Failed at Executing' CNT-1)
    CNT:=0;
    END;
    END;
    END MYPROC

    user11791474 wrote:
    i need to create pl sql because if any of these files are errored then i need to terminate my execution . I guess just executing 15o sql files in one wrapper sql will keep executing next sql files.
    do you have any idea about how to call sql files in pl sql then ?No you can't call an sql*plus file in Pl/sql.
    What you can do in SQl*plus is someting like this:
    untested
    -- set an exit condition
    WHENEVER SQLERROR EXIT ROLLBACK
    spool logscripts.log
    prompt "running script 1"
    @script1.sql
    prompt "running script 2"
    @script2.sql
    prompt "running script 3"
    @script3.sql
    prompt "running script 5"
    @script4.sql
    prompt "running script 6"
    @script5.sql
    spool off

  • How to execute a script(.sql) file from a PL\SQL procedure

    I would like to know how to execute a .sql file from a stored procedure and the result of it should update a table. My .sql file contains select statements.

    Hi!
    just go through the following piece of code -
    SQL> ed
    Wrote file afiedt.buf
      1  declare
      2    str varchar2(200);
      3  begin
      4    str := '@C:\RND\Oracle\Misc\b.sql';
      5    execute immediate(str);
      6* end;
    SQL> /
    declare
    ERROR at line 1:
    ORA-00900: invalid SQL statement
    ORA-06512: at line 5ORA-00900: invalid SQL statement
    Cause: The statement is not recognized as a valid SQL statement. This error can occur if the Procedural Option is not installed and a SQL statement is issued that requires this option (for example, a CREATE PROCEDURE statement). You can determine if the Procedural Option is installed by starting SQL*Plus. If the PL/SQL banner is not displayed, then the option is not installed.
    Action: Correct the syntax or install the Procedural Option.
    Regards.
    Satyaki De.

  • How can I execute Dynamic SQL statement in Forms?

    Hi All,
    I have to execute dynamic SQL statement from Forms
    Below statement I have to execute
    "EXECUTE IMMEDIATE v_stmt INTO v_return;".
    Googled for the same got results saying, Better use Database function or procedures to execute these Dynamic Statements but We want to execute in forms only.
    Can any one help me..
    Thanks,
    Madhu

    So in short you are trading code obfuscation for maintainability and the ability to share code between tools? If from somewhere else you need a procedure already implemented in database PL/SQL (and now ported to forms) this would mean you'd need to implement it in every other tool. In times where you might want to integrate your forms with $other_technology and putting stuff on the database is the first step to share functionality you just go the opposite way? And all that because someone is afraid that somebody might steal your source code? I am sorry to be blunt, but this is just plain stupid.
    Leaving aside that some things like Analytic Functions, Bulk processing or execute immediate are not even available in forms your software consists of how many LOC? How long does it take to bring a new developer up to speed with your source code? Imagine how long that would take for a developer who doesn't have coleagues who know their way around.
    And just so you know: I work for a ISV selling a closed-source product as well. We have 200+ customers all over the planet. We are well aware that wrapped packages can be reverse engineered. The premise is: stored procedures can be reused in every tool we have, if it makes sense to put stuff on the database by all means do it. If someone would want to reverse engineer our software I'd wish him good luck as some parts are implemented in such a hilarious complicated way I have troubles understanding them (and quite frankly I refuse to understand certain parts, but that's another story). I do work for almost 10 years for that ISV.
    In any case the possible solutions have already been mentioned: you have exec_sql, create_group_from_query and forms_ddl to execute dynamic SQL in forms whereas forms_ddl is a one way street and most certainly not the thing you need or want. Take a look at the documentation for the other 2 things.
    cheers

  • Execute the sql file

    hi all
    i want to execute a sql file from Pl/sql block.
    plz help me...
    thanx
    Ashish

    This is one way
    --  Program Name:   EXTcmd.sql
    --  This sql will create a java class.
    --  Parameters:  &1 = OS command string
    CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED "EXTcmd" AS
    import java.lang.Runtime;
    public class EXTcmd
      public static void execute (String command)
       try
           Runtime rt = java.lang.Runtime.getRuntime();
           rt.exec(command);
       catch(Exception e)
        System.out.println(e.getMessage());
        return;
    --  Program Name:   EXT_execute_cmd.sql
    --  This sql will create a stored procedure to using java class to execute the command.
    --  Parameters:  &1 = OS command string
    create or replace procedure EXT_execute_cmd (cmd IN VARCHAR2)  as
       language java name 'EXTcmd.execute( java.lang.String)';
    --  Program Name:   EXT_job_execute.sql
    --  Called by: Oracle job
    --  Call        : EXT_execute_cmd
    create or replace procedure EXT_job_execute
             (P_EXEC_CMD IN VARCHAR2) is
    cmd_string varchar2(200);
    begin
      cmd_string := 'PUT YOUR SCRIPT HERE';
      EXT_execute_cmd(cmd_string);
    end EXT_job_execute;
    null                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • I need help moving my Photoshop 7 from my old laptop to my new laptop which is running Windows 7 Enterprise.  I've tried two routes unsuccessfully.  I install the CD, it does not autoplay.  I execute Autoplay.exe at the root directory, I am welcomed, I ch

    I need help moving my Photoshop 7 from my old laptop to my new laptop which is running Windows 7 Enterprise. I’ve tried two routes unsuccessfully. I install the CD, it does not autoplay. I execute Autoplay.exe at the root directory, I am welcomed, I choose English, I accept the EULA, I get the Install/Explore choices window, with the Install button already selected, I click the Photoshop button, the CD spins, and nothing happens.  In the 2nd attempt I execute Setup.exe in the Photoshop directory, and nothing happens at all.  I’m never even offered the opportunity to enter my product code. What should I do?

    There could is likely a compatibility problem between the old software and the newer operating system.

  • How to execute sql file from servlet

    Hi,
    I am using JSP, Servlets and Oracle 8i in my application. I want to execute .sql file from java code. Is it possible to do that,
    as we execute .sql file from sql plus prompt.
    Suppose I have abc.sql file and I want to execute it from java code.
    If any body have the solution then pl. reply with sample code.
    Thanks,
    Rajesh

    If any body have the solution then pl. reply with
    sample code.No, no, dec - s/he doesn't want the actual solution, but the full code!
    /k1

Maybe you are looking for

  • Can't open PSE 7

    I can't open photoshop elements, I keep getting the following error messages: Adobe Photoshop Elements(Editor) has stop working And then it says: A problem caused the program to stop working correctly. Windows will close the program and notify you if

  • [OWB 10g] Complex Condition in a transition

    Hi all, I want to do a complex condition from my "AND1" component to my "END_SUCCESS". Here is a picture of my problem : [http://craweb.free.fr/owb/flux.png] In fact, I want to do this condition (you can see it in the previous picture) : IF after the

  • Set custom colors for ONE particular window

    Hi, I often need to compare two files, say a "good, or sample" one, with a "bad, or in preparation". They both have the same name (like web.config CV.docx, MyClass.cs), so when I visualize them, I cannot distinguish easily whioch is which. For exampl

  • MBP 15" 2007 with internal monitor off, main monitor signal on external monitor

    My MBP 15" 2.2 2007 2 MB RAM NVIDIA GeForce 8600 internal monitor has no video after startup.  If I connect my Apple Cinema Display to it, the video of the main monitor is on it, and the internal screen stays off.  If I hit the "Detect displays" swit

  • Error out

    I have a super quick question: In a lot of sample Labview programs, I notice that the sub VI's are connected by the error out icons. For example, a simulate signal express error out is connected the graph that displays this signal by error in (with a