Home » Developer & Programmer » Forms » SQL script
SQL script [message #563591] Wed, 15 August 2012 10:47 Go to next message
ollivier
Messages: 19
Registered: January 2012
Location: chihuahua
Junior Member
Hi:
I want to run a .sql script from FORMS !

Some one can help me ?

Thanks.
Re: SQL script [message #563604 is a reply to message #563591] Wed, 15 August 2012 15:28 Go to previous message
Littlefoot
Messages: 21813
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
First of all, why wouldn't you put code from that SQL script into a form procedure and simply execute that procedure? That would be the simplest way to accomplish that task, I suppose.

If you insist on calling a SQL script, here's one way to do that: create an operating system batch script (on MS Windows, that would be the .BAT file) which would call the SQL script. Test it from your operating system command prompt. For example:
REM SELECT_DEPT.BAT

sqlplus scott/tiger @select_dept

-- SELECT_DEPT.SQL

select * from dept;

Execution:
C:\Users>select_dept

C:\Users>REM SELECT_DEPT.BAT

C:\Users>sqlplus scott/tiger @select_dept

SQL*Plus: Release 11.2.0.2.0 Production on Sri Kol 15 22:26:03 2012

Copyright (c) 1982, 2010, Oracle.  All rights reserved.

Connected to:
Oracle Database 11g Express Edition Release 11.2.0.2.0 - Production

    DEPTNO DNAME          LOC
---------- -------------- -------------
        10 ACCOUNTING     NEW YORK
        20 RESEARCH       DALLAS
        30 SALES          CHICAGO
        40 OPERATIONS     BOSTON

SQL>

Now that you are sure that it works OK, call the operating system batch script from a form using HOST built-in:
-- WHEN-BUTTON-PRESSED trigger

HOST('select_dept');
Previous Topic: Forms 6i Help not Shown
Next Topic: Printing PDF directly
Goto Forum:
  


Current Time: Thu Jul 04 16:30:46 CDT 2024