Running 2 API's in 1 sql script or seperately?
hello.
Running 2 API's in 1 script or seperately?
I'm setting up a process of importing employee records into per_all_people_f table via 2 API's (create_gb_employee & create_person_address) but I'm running into problems. This is making me wonder is this the right method? Has anybody else ran 2 API's in 1 sql script? I can't find anything on both here or Metalink..
Ive successfully tested running both API's in seperately (using a Hardcoded employee details) but am encountering SQL problems when combining the two..
many thanks for looking..
Steven
Thanks Am0x for the suggestion but its still falling over at the line where the first API ends
and the second the begins.
======================== error message =====================
DECLARE
ERROR at line 1:
ORA-06550: line 65, column 22:
PLS-00103: Encountered the symbol ";" when expecting one of the following:
) , * & = - + < / > at in is mod remainder not rem
<an exponent (**)> <> or != or ~= >= <= <> and or like
between || multiset member SUBMULTISET_
The symbol ", was inserted before ";" to continue.
Commit complete.
======================== error message =====================
======================== actual code =====================
-- SL's HRMS New Employee's Personal and address details Migration--
SET SERVEROUTPUT ON SIZE 100000
DECLARE
/*Following Variables declared to hold Values returned by the API (Out Parameters) */
ip_p_address_id NUMBER;
ip_p_object_version_number NUMBER;
l_employee_number varchar2(20):='00019834';
l_person_id number:= 134571;
l_validate BOOLEAN DEFAULT FALSE;
l_assignment_id number;
l_per_object_version_number number;
l_asg_object_version_number number;
l_per_effective_start_date date;
l_per_effective_end_date date;
l_full_name varchar2(40);
l_per_comment_id number;
l_assignment_sequence number;
l_assignment_number varchar2(20);
l_name_combination_warning boolean;
l_assign_payroll_warning boolean;
l_address_id NUMBER;
l_object_version_number NUMBER;
--dbms_output.put_line('Starting to import the Employee records for today: ' || SYSDATE);
--dbms_output.put_line('');
BEGIN
BEGIN
hr_employee_api.create_gb_employee
p_validate => l_validate --FALSE
,p_hire_date => SYSDATE
--,p_hire_date => to_date('11-Jul-2001','DD-MON-YYYY')
,p_business_group_id => 0
,p_first_name => 'Jack'
,p_middle_names => NULL --'Sell'
,p_last_name => 'Beats'
,p_sex => 'M'
,p_ni_number => 'WP924591B'
,p_employee_number => l_employee_number
,p_person_id => l_person_id
,p_assignment_id => l_assignment_id
,p_per_object_version_number => l_per_object_version_number
,p_asg_object_version_number => l_asg_object_version_number
,p_per_effective_start_date => l_per_effective_start_date
,p_per_effective_end_date => l_per_effective_end_date
,p_full_name => l_full_name
,p_per_comment_id => l_per_comment_id
,p_assignment_sequence => l_assignment_sequence
,p_assignment_number => l_assignment_number
,p_name_combination_warning => l_name_combination_warning
,p_assign_payroll_warning => l_assign_payroll_warning);
END;
BEGIN
hr_person_address_api.create_person_address
p_validate => l_validate,
p_effective_date => SYSDATE,
p_pradd_ovlapval_override => NULL,
p_validate_county => NULL,
p_person_id => 134571;
p_primary_flag => 'Y',
p_style => 'GB_GLB',
p_date_from => SYSDATE,
p_date_to => NULL,
p_address_type => NULL,
p_comments => NULL,
p_address_line1 => 'Waterloo Rd',
p_address_line2 => 'Cockfield',
p_address_line3 => 'Darlo',
p_town_or_city => 'Saarrfff Laaarrnnnddaann',
p_region_1 => NULL,
p_region_2 => NULL,
p_region_3 => NULL,
p_postal_code => 'NE13 6DF',
p_country => 'GB',
p_telephone_number_1 => '0122 26453148',
p_telephone_number_2 => NULL,
p_telephone_number_3 => NULL,
p_addr_attribute_category => NULL,
p_addr_attribute1 => NULL,
p_addr_attribute2 => NULL,
p_addr_attribute3 => NULL,
p_addr_attribute4 => NULL,
p_addr_attribute5 => NULL,
p_addr_attribute6 => NULL,
p_addr_attribute7 => NULL,
p_addr_attribute8 => NULL,
p_addr_attribute9 => NULL,
p_addr_attribute10 => NULL,
p_addr_attribute11 => NULL,
p_addr_attribute12 => NULL,
p_addr_attribute13 => NULL,
p_addr_attribute14 => NULL,
p_addr_attribute15 => NULL,
p_addr_attribute16 => NULL,
p_addr_attribute17 => NULL,
p_addr_attribute18 => NULL,
p_addr_attribute19 => NULL,
p_addr_attribute20 => NULL,
p_add_information13 => NULL,
p_add_information14 => NULL,
p_add_information15 => NULL,
p_add_information16 => NULL,
p_add_information17 => NULL,
p_add_information18 => NULL,
p_add_information19 => NULL,
p_add_information20 => NULL,
p_party_id => NULL,
p_address_id => ip_p_address_id,
p_object_version_number => ip_p_object_version_number);
END;
dbms_output.put_line ('Address Updation/Insertion has been successful!');
dbms_output.put_line ('');
--DBMS_OUTPUT.put_line (SQLERRM);
end;
commit;
exit;
======================== actual code =====================
Similar Messages
-
Is it Possible to Run SQL Script from Java prog
Hello
Is there any API by which we can run SQl Script file ,
Just by giving database configration parameters and SQL Script file Path ,it will execute that script automaticallyYou can excute SQL statemetns throught JDBC, but that doesn't have a facility to read those statements from a file. You'd have to write code to read the file and create and execute statements through JDBC. That should be pretty straightforward though.
It's conceivable that there's a third party library out there that does it, if you know what to look for.
If you're not familiar with JDBC, check out http://java.sun.com/developer/onlineTraining/Database/JDBC20Intro/ -
How can I run a SQL script file...
How can I run a SQL script file from a location on my computer without providing the whole path?
Is there some way I can set a "Working folder" in SQL Plus??
Thanks!
TomYou can create an environment variable called "SQLPATH" which is a list of directories that SQL*Plus will search for your .SQL
scripts.
I would like to use another directory than the oracle/bin...
How can I do this ??
Hello,
U can do this by this way:
Save odm_script.sql file to the default Oracle
directory i.e. Oracle-Home/bin and Run following command
through SQL Plus.
SQL>@Script_Name
I hope this will resolve ur problem.
Regards,
Omer Saeed Khan. -
How to run a sql script in oracle forms
Hi,
For me there is an sql script. I need to run that sql script in forms.
Actually we will run that sql file in pl/sql developer by giving @and the file name.
But how to run that file in forms.
Can any one help on these.Which book I have to look.
ThanksActually there is a script files which will drop all the indexes and tables.
DROP querry will be there for each index and each table.
So I run the script all the indexes and all the tables will be deleted. So using forms I have to run that script.
Thanks -
Clearing sequences, running sql script
Hi,
I'm using OWB 10.1.0.4.0 and I use a sequence to create a surrogate key in my tables. For the tabels that are deleted during the proces I want these sequences set to 1 again.
Is there a possibility to run a sql script in a mapping or in the proces flow (with a drop, create, grant statement for the sequence) ?
Thanks in advance,
ArjanThx, I'll try that on monday. If I'm correct I can import a .sql in a custom procedure?
I'll update the thread on monday. -
Running sql script from pl/sql
Is there any standard way to run an external sql script from pl/sql
I really appreciate any assistance.If you want, I did start writing a function reading and executing statements out of sql script with utl_file.
can I issue this command in PL/SQL: EXECUTE IMMEDIATE '@filename.sql';
the function could be extended for DDL, session setting, etc...
Regards
Laurent -
Getting windows error during running the sql scripts from form 6i
I made a little form application. The purpose of this application is to generate explain plan for a particular SQL. Some sql scripts run internally in order to populate the result on forms screen after pressing the forms button but I am getting windows error during running the sql scripts from form 6i.
I am using forms 6i with patch 17 with Oracle 10G database on windows 2000 professional on same computer.
This application runs fine with 8i.
Please inform me where the problem is and how to overcome it.
Zafri.I am using Text_IO in my form's when button press trigger , inorder to create the
text file, then in the same when button press triger
I am calling RMAN via host command in order to run the script which was created by text_IO.
Below you find some of the code. I will appreciate if you solve the problem.
when button press trigger:
Declare
in_file3 Text_IO.File_Type;
linebuf3 VARCHAR2(1800);
output11 varchar2(1000);
BEGIN
output11:='C:\EXPLAIN_PLUS\misc\rm_file.bat ';
Host(output11,no_screen);
:sql.execution_plan:= 'Working........................';
synchronize;
in_file3 := Text_IO.Fopen('c:\explain_plus\misc\create_table.txt', 'w');
Text_IO.Put_Line(in_file3, linebuf3);
Text_IO.put_line(in_file3,' ');
Text_IO.put_line(in_file3,' run { sql "create table PLAN_TABLE (statement_id,...object_name varchar2(30),object_instance numeric,object_type varchar2(30),optimizer varchar2(255),search_columns number,id .....partition_start varchar2(255),partition_stop varchar2(255),partition_id numeric,other long,distribution varchar2(30)) "; } ');
Text_IO.put_line(in_file3,' ');
Text_IO.put_line(in_file3,' ');
Text_IO.FCLOSE(in_file3)
Declare
un VARCHAR2(80);
pw VARCHAR2(80);
cn VARCHAR2(80);
output VARCHAR2(1000);
output2 VARCHAR2(1000);
dummy varchar2(40);
in_file Text_IO.File_Type;
linebuf VARCHAR2(1800);
BEGIN
Get_Connect_Info(un,pw,cn);
/* for Plan_table Begg. Second INNER BLOCK */
declare
dummy2 varchar2(40);
begin
select table_name into dummy2 from all_tables where table_name='PLAN_TABLE';
if dummy2 = 'PLAN_TABLE' then
output2:='rman target/ nocatalog @C:\EXPLAIN_PLUS\MISC\TRUNC2.txt ' ;
Host(output2,no_screen);
end if;
exception
when no_data_found then
output2:='rman target/ nocatalog @C:\EXPLAIN_PLUS\misc\create_table.txt ';
Host(output2,no_screen);
end; -- -
OEM12c Job - Run a SQL Script from a central location against multiple targets
Hi All:
I need to execute a SQL script that can be run as OEM Job against multiple targets from a single location so that the output csv files are all in that central location. My problem is that the sql script job documentation says "Make sure that the script file is installed in the appropriate location on all targets". Is anyone aware of a way I can do this so that the SQl script is executed from a location on my OMS console?
CheersHi
Create SQL job to run against on the server. Save those results (csv) file in local target. And crete one OS job, to collect all csv files into your OMS Console.
Regards
Krishnan -
Running the same sql script in multiple databases
Hello,
What is the method to run the same sql script in multiple databases? I want to write a unix script that would select from different databases and run a sql/plsql script in those different databases. What are the ways to write such a unix script? Thank you in advance.Just have a parameter which takes in the oracle connection parameters and use it in your sqlplus script with your shell script.
Your sqlplus script can have a procedure/function call or an anonymous block;
Then have a wrapper script to call the original script with different connection parameters. Hope this helps. -
How to run sql scripts using batch file for a web dynpro data dictionary
Hi,
I want to develop a sql script to be executed on the server alongwith the installation of a product to pre-populate web dynpro data dictionary tables required for the application.
I further require to make the scripts independent of the database name,so that it can be run at any client environment.
Your help will be appreciated and rewarded.See shoblock's answer
call sql script from unix
masterfile.sql:
@file1 &1
@file2 &2
@file3 &3
@file4 &4
then just call the master script:
sqlplus userid/password @masterfile <p1> <p2> <p3> <p4> -
Running utlbstat.sql script
for testing performance i want to run the utlbstat.sql script
can i run this script using windows run command.
i cant run utlesast.sql also.
so i cant see the report using report.txtThe UTLBSTAT.SQL is ran from the SQL prompt in SQLPLUS like this as in the case of UN*X:
SQL> @ ${ORACLE_HOME}/rdbms/admin/utlbstat.sql
The @ tells SQLPLUS to read the commands/statements from a file.
It is on a similar path in windoze.
William -
Jdeveloper-Running SQL Script Problem
Hi
Iam new bee to Jdeveloper.
I have developed sample datbase application in jdeveloper;
Can any one explain me how to excute Sql script??
Thanx in advance
smileZiqew,
you configure a database connection in JDeveloper where you specify the database connect information in the non-tnsnames form of server, port and SID.
Running a scritp against SWL*Plus, you select the SQL script in JDeveloper and choose SQL*PLus from teh context menu. I am doing this all the time and don't get problems.
Maybe your misunderstanding is that you add TNS names to where database SID is expected
Frank -
Running SQL script at a certain time
Please suggest in application express what I need to do to run a sql script say 6.00 AM every day
Hello,
Take a look at DBMS_SCHEDULER, here's a good link with more information -
http://www.oracle-base.com/articles/10g/Scheduler10g.php
John.
http://jes.blogs.shellprompt.net
http://apex-evangelists.com -
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
kelvinHi peter. i think you cannot run files spread across different locations.
--the method which u specified always looks to the defined path -
Running a SQL Script to Create an Object Type
When I do Database Development with JDeveloper and fellow the instruction at
http://www.oracle.com/technology/obe/obe1013jdev/dbdevelopment/obe_%20dbasedevmt.htm
and try to Running a SQL Script to Create an Object Type by Right-clicking emp_rec.sql in the editor and
choose Run in SQL*Plus > hrconn, the new Obuect type can not created. The screen flashs and I only got the
message
"Invoking SQL*Plus...
D:\oracle\product\10.2.0\db_1\BIN\cemutls.exe
hr@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)))(CONNECT_DATA=(SID=ORCL)))
@emp_rec.sql" and nothing else (No error like JBO-XXXXX).
Can anybody Help Me? Thanks a lot!
SID: ORCLHi Simon,
Having had a closer look at your original message it seems that rather than selecting the SQL*Plus executable in the directory you have managed to select the file 'D:\oracle\product\10.2.0\db_1\BIN\cemutls.exe'.
If you go to 'Tools | Preferences' and select the 'Database Connections' node and alter the 'SQL*Plus Executable' field to 'D:\oracle\product\10.2.0\db_1\BIN\sqlplus.exe' and then try again, this should then work.
Regards,
Lisa
Maybe you are looking for
-
How do I use time machine backup to restore onto a different computer
I am trying to troubleshoot the best way to back up my Mac. I have been a mac user since 20009 and always used a time machine. The two times I have needed it for backup, my computer did not read the portion the backup was. You could tell under dis
-
Problem in credit memo request
Dear Guru's, I have created a credit memo request with refrence to a standard invoice, in which they are 7 line items and there is manual excise. after i have saved and i went to display mode and selected header conditions, in that the taxes were cha
-
SC based on item category po document type need to be choosen
Hi I have a require ment Based on the SC item category or ........ etc the PO document type must be choosen ex: If SC item is LIMIT item then when ur creating the po The PO document type must be zlimit PO ...some thing like same way for ser
-
I just downloaded 950 photos on iPhoto and deleted them off my camera and now under last import there is only 4 photos and i can't find the others?? There is a whole bunch of blank events in the library with no photos in them all with todays date? He
-
Dump while converting amount in script
Dear all , I am facing a problem while passing a value retreived from the script. i.e read table intab index 1. i am reading the value from intab and the value is in this format. 1,234.00 when passing this value to the variable defined for the import