Calling a package from shellscript
Hello,
I am trying to run open interface for GL. I am a newbie to oracle apps.
The flow and steps i am following are
1. Load some sample data into staging table using sqlldr.
2.Validate and insert the data into gl_interface using pl/sql package.
3. Write a shell script to call the sqlldr and pl/sql package.
4.Register the script as concurrent program in apps.
When i run this request ,the log file shows no errors. But the data is not loaded in gl_interface table.
I tried with a simple pl/sql procedure (not a package) it ran fine. The data was loaded.
ex:
sqlplus user/pwd<<EOF
exec sql_proc();
EOF
But now i have two different procedures, so created
a package. How do i call that package in the shell script. I also have IN parameters for the second procedure.
Should i mention them here (in the shell script).
i tried
sqlplus user/pwd<<EOF
exec package.sql_proc();
exec package.sql_proc2();
EOF
Any help would be really appreciated.
Thank you,
Srikanth
You can define the variables in your shell script to pass to the package/procedure for e.g. if you wanted to execute fnd_client_info.setup_client_info, your shell script would look something like this
p_usr_id=$1
p_app_id=$2
p_resp_id=$3
( sqlplus -s /nolog << end_of_sql
connect $p_sqlpwd
set head off
set feed off
set verify off
exec fnd_client_info.setup_client_info($p_app_id, $p_resp_id, $p_usr_id, 0);
exit
end_of_sql
)
Similar Messages
-
How to call a package from the Report in Oracle Application Express
How to call a package from the Report in Oracle Application Express
Hello,
What do you mean? Something like SELECT mypackage.function( par1, par2) from dual?
Or do you want to execute a procedure when something happens on the page, like clicking a button?
Greetings,
Roel
http://roelhartman.blogspot.com/
You can reward this reply by marking it as either Helpful or Correct ;-) -
Calling DTS package from Stored Procedure
I am getting error calling DTS package from CF.
So i want to call DTS package from SQL Server Stored
Procedure.
DTS package create text file. So no need of input or output
parameter.
What is the syntax?.
thanks for ur help.Ted Kruger explains how this can be done in his blog post
Run SSIS Package from Stored Procedure
For every expert, there is an equal and opposite expert. - Becker's Law
My blog -
Calling SSIS package from DTEXEC in SQL Server 2012
Hello,
I have a package called test.dtsx developed in SSIS vs 2010 (project deployment model). It has two project parameters one is db connection (string) and one is classnumber(string). This package has been deployed as file system and in SSISDB. I want to
assign the following values to the project parameters
$Project::DBConnection - Data Source=localhost;User ID=User;Password=password;Initial Catalog=testdb;Provider=SQLNCLI11.1;Persist Security Info=True;Auto Translate=False;
$Project::Classnumber - 10
What is the syntax to call this package from dtexec passing values for parameters
1. as a file system deployment
2. as a package in SSIS db(catalog)
thankshttp://msdn.microsoft.com/en-ca/library/hh231187.aspx has an example
Dtexec /isserver “SSISDB\MyFolder\MyProject\test.dtsx” /server “.” /parameter $Project::DBConnection;thevalue /parameter anotherparam(int32);12
Arthur My Blog -
Is it possible to call a package from DB in ADF?
Hi,
I am using Jdev 10.1.3.3 with ADF. I want to call a package from
my DB from jdev. Is it possible with ADF? Please let me know.
Thanks,
VenkiHi,
This is my code to call the package.
String amDef = "model.service.DAFService";
String config = "DAFServiceLocal";
ApplicationModule am =
Configuration.createRootApplicationModule(amDef, config);
CallableStatement cstmt = null;
String stmt = "begin call CP_DAF_PKG.DAF_PROCESS(?,?,?,?,?,?,?,?,?); end; ";
cstmt = getDBTransaction().createCallableStatement(stmt,0);
But in this case, I am getting
oracle.jbo.InvalidOwnerException: JBO-25301: Application module is not a root app module but has no parent
I understand the reason for this error. I need to call the
createcallableStatement from the application module that I have above.
Something like am. (call the package)
But not sure about any method which does that..
Please let me know if you know the way to solve it.
Thanks,
Venki -
How to call a package from within a package
How would I call a package from within a package and pass variables to it. For instance I am trying to pass variables to a log package from another package when a user inserts or updates a table
First, technical questions need to be addressed to one of the technical forums. Products | Database | SQL & PL/SQL would be appropriate for this question. Please direct any followup to that forum.
Second, you cannot call a package; a package is a collection of stored procedures and functions. You can call a packaged function or procedure from another package simply by specifying the package name and the procedure
CREATE OR REPLACE PACKAGE pkgA
AS
PROCEDURE callPkgB;
END;
CREATE OR REPLACE PACKAGE BODY pkgA
AS
CREATE PROCEDURE callPkgB
AS
BEGIN
pkgB.someProcedure( 'Some argument' );
END callPkgB;
END pkgA;In general, any packaged procedure can be called by specifying the schema, package, and procedure name, i.e.
EXEC mySchema.myPackage.myProcedurethough the schema and package can be omitted if the calling procedure is in the same schema or package.
Justin
Distributed Database Consulting, Inc.
http://www.ddbcinc.com/askDDBC -
How to call a package from a different instance?
Dear all:
how to call a package from a different instance?
for example:
package A belongs to instance A1
package B belongs to instance B1
Now I want to call the package B in instance A1, how can I do ? my environment is oracle 10g
Regards
TerryTerry Chen wrote:
Dear all:
how to call a package from a different instance?
for example:
package A belongs to instance A1
package B belongs to instance B1
Now I want to call the package B in instance A1, how can I do ? my environment is oracle 10g
First you have to create create dblink in A1 database as below
CREATE DATABASE LINK INSA1
CONNECT TO USER_NAME IDENTIFIED BY <pass>
USING 'B!' Then you can execute exec pack_b@INSA1; -
While calling plsql package from Pro*c getting ORA-1426 error
Hi Friends
I am calling a package from Pro*c and getting numberic overflow error ORA-1426 but when i introduce a debug message such as printf or calling standard oracle utility to write in a log file no error comes. So how just introduction of debug messages is resolving the error.Can any one throw some light on it, whether it is some kind of synchronization issue or something else
Regards
AbhijeetPretty hard to guess here since you're not providing any sample code.
However:
"Internally, PL/SQL assigns the values of the bounds to temporary PLS_INTEGER variables, and, if necessary, rounds the values to the nearest integer. The magnitude range of a PLS_INTEGER is -2147483648 to 2147483647, represented in 32 bits. If a bound evaluates to a number outside that range, you get a numeric overflow error when PL/SQL attempts the assignment. "
http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14261/loop_statement.htm#sthref2852 -
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
ENDIt 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 SSIS package from C# Windows Service Fails
Hi All.
I've got an SSIS package that reads from an Excel file and populates a database. The Excel file location gets passed in to the package as a variable. Also the Protection Level of the package is set to EncryptSensitiveWithPassword.
This all works fine when I run the package from Visual Studio or using DTEXEC. When I try to run it from a C# Windows Service though I get the following exception:
SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005.
An OLE DB record is available. Source: "Microsoft Office Access Database Engine" Hresult: 0x80004005 Description: "The Microsoft Office Access database engine cannot open or write to the file ''. It is already opened exclusively
by another user, or you need permission to view and write its data.".
SSIS Error Code DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER. The AcquireConnection method call to the connection manager "Input Excel Connection" failed with error code 0xC0202009. There may be error messages posted before this
with more information on why the AcquireConnection method call failed.
Dedupe Worksheet failed validation and returned error code 0xC020801C.
One or more component failed validation.
There were errors during task validation.
The windows service runs with LocalSystem account and the following code is used to call the SSIS Package:
Application app = new Application();
Package package = null;
app.PackagePassword = "*******";
//Load the SSIS Package which will be executed
package = app.LoadPackage(@"C:\Projects\DataDedupeMatch\DataDedupeMatch\DataDedupe.dtsx", null);
//Pass the varibles into SSIS Package
package.Variables["User::FilePath"].Value = e.FullPath.Replace(@"\\", @"\");
Microsoft.SqlServer.Dts.Runtime.DTSExecResult results = package.Execute();
I would really appreciate if someone could help me out with this.
Thanks in advance,
DeonInstead of hosting the SSIS runtime in your service, you should use a separate host process for your SSIS package. You're using the Office drivers, which aren't designed or supported for running in long-lived unattended processes like a Windows Service.
You can use your own SSIS hosting code, or just use dtexec.exe to host your package. In either case you would start the child process with
Process.Start.
David
David http://blogs.msdn.com/b/dbrowne/ -
Calling SQL packages from java
How do I call ORACLE sql packages from java?
We are still using Oracle 7.3. Any sample code
would be appreciated.utility.processPLSQL( connRisk,
" Begin "
+ " hvar_sum.p_load_var_summary_data("
+ " '" + dfCall.format( priceDate ) + "', "
+ " '" + promptMonth + "',"
+ daysBack + ","
+ aliasType + ","
+ "'" + connRisk.owner + "'"
+ "); "
+ " end ; ",
"Load VaR Summary Data",
utility.noLogMsg ) ;
public boolean processPLSQL(
MyConnection conn,
String sql,
String dataType,
boolean createLogMessage ) {
double startTime = conn.log.getStartTime() ;
try {
CallableStatement cs = conn.theConnection.prepareCall(sql);
cs.execute() ;
cs.close() ;
conn.theConnection.commit();
if ( createLogMessage ) conn.log.logTiming( dataType, startTime ) ;
} catch ( SQLException e ) {
conn.log.logError( "Utility.processPLSQL; SQLException Error: " + e ) ;
System.out.println(new java.util.Date().toString() + "; User: " + conn.user
+ "; SQL: " + sql );
return false ;
return true ;
} -
Can someone help me? I'm very new to HTMLDB and basically to Oracle. I need to create a simple package (which I know how to do) and call it from HTMLDB (which I DON'T know how to do). Essentially, I'd like to have a user select an item from a drop-down, and pass the value of what's been selected to a function in a package. The function would hopefully be able to return some values to create a tree, then.
I'd really REALLY appreciate any help and especially simple examples...
Thanks!
SteveSteve,
See: Calling a stored plsql procedure
or: execute stored procedure in html_db
Sergio -
SpRunDTS for calling DTS package from sp
CREATE PROCEDURE spRunDTS
@PKGName varchar(500),
@PckPwd varchar(100),
@OMessage varchar(2000) OUTPUT
As
--Declaring the variables for the DTS Package
Declare @hr int,
@oPKG int ,
@Server_Name varchar(200),
@Cmd varchar(1000),
@Server_Uname varchar(100),
@Server_Pwd varchar(100),
@PackagePwd varchar(100),
@PackageName varchar(500)
--- Setting the credentials
set @Server_Uname ='cpvar_dev'
set @Server_Pwd ='Stamford18'
set @PackagePwd = ltrim(rtrim(@PckPwd))
set @OMessage='Success'
--- Creating the DTS Package object
EXEC @hr = sp_OACreate 'DTS.Package', @oPKG OUT
IF @hr <> 0
BEGIN
set @OMessage = '*** Create Package object failed'
EXEC @hr = sp_OADestroy @oPKG
RETURN
END
select @Server_Name = ltrim(rtrim(@@servername))
set @PackageName=ltrim(rtrim(@PKGName))
SET @Cmd = 'LoadFromSQLServer("'+@Server_Name +'", "'+@Server_Uname+'", "'+@Server_Pwd+'", 256, "' + @PackagePwd +'", , , "'+@PackageName+'")'
print @Cmd
EXEC @hr = sp_OAMethod @oPKG, @Cmd, NULL
IF @hr <> 0
BEGIN
set @OMessage = '*** Load Package failed ' + @PKGName
EXEC @hr = sp_OADestroy @oPKG
RETURN
END
--Executing the Package:
EXEC @hr = sp_OAMethod @oPKG, 'Execute'
IF @hr <> 0
BEGIN
set @OMessage = '*** Execute failed'
EXEC @hr = sp_OADestroy @oPKG
RETURN
END
--Cleaning up:
EXEC @hr = sp_OADestroy @oPKG
IF @hr <> 0
BEGIN
set @OMessage = '*** Destroy Package failed'
RETURN
ENDThanks for sharing.
-
Getting error when calling package from master
Hi ,
I am facing one issue ,
when i am running package indivisually its running fine , but when I am calling same package from Master package it gets failded.
below is the error massage which I am getting.
"Exception has been thrown by the target of an invocation"
regards,
Vipin jha
Thankx & regards, Vipin jha MCPHi Vipin,
In addition, here is an article regarding how to execute a package from another package for your reference. Please see:
http://svangasql.wordpress.com/2012/05/01/parent-child-package-ssis-2012-execute-package-task/
Please help to elaborate your issue with more detail so that we can help you to solve this issue in a effecive manner.
Elvis Long
TechNet Community Support -
Help with calling packages from crystal reports
hi I am trying to call a package from crystal reports, but geting an error
Failed to open a rowset
4200:datadirect:odbcdriver:odbc oracle driver: unrecognised escape sequence.
im sure its somthing realy stupid im doing wrong any ideas????
the command in crystal is
{CALL Enhanced_Pharos_Report.run_report
(NVL({?var_detail_id},0))}
the package, which works as a stand alone object is
----------spec------------------
create or replace package Enhanced_Pharos_Report
AS
TYPE result_set_type IS REF CURSOR;
PROCEDURE run_report
(var_detail_id NUMBER, v_Media_Object_Name out varchar2);
end;
-----------body-----------------------
create or replace package body Enhanced_Pharos_Report as
v_Media_Object_Name varchar2(300);
function Media_Object_Name(var_Detail_id Number) return varchar2 as
Result varchar2(300);
begin
SELECT promo_name
INTO Result
FROM promo
WHERE promo_id = (SELECT promo_id
FROM promo_plan
WHERE promo_plan_id = (SELECT promo_plan_id
FROM event_promotion
WHERE detail_id = var_Detail_id));
return(Result);
end Media_Object_Name;
PROCEDURE run_report
(var_detail_id NUMBER, v_Media_Object_Name out varchar2)
is
begin
v_Media_Object_Name := Media_Object_Name (var_detail_id);
end;
end;Are you able to view your report on the browser in the format:
http://myserver:portno/report_name.rpt
Maybe you are looking for
-
Issue with creation of a materialized view
Hi, I have a SQL query that works fine. But when I create a materialized view using the query, a few columns in the MV do not get populated at all. What could be the issue here? regards Prem
-
it just popped up after a while. it might be related to sync because it appeared after i began using the sync fuctions.
-
Automatic update of material master purchasing group
Dear. Does exist a chance in order to update the purchasing group of material master from pur.group of info record or from pur. group of the last purchase order ? I want to avoid a manual update of material master. Thanks.
-
The loupe in Bridge can't focus on a close up at full res. It displays tiny pixels. I have 4GB RAM and thumbnails set @ 1000 MB in Prefs. Funny, I had no problem on a Mac with less RAM. Or is Leopard the problem? Help!
-
LDAP-Server configuration and using
Hi, can anyone tel me how it function with the LDAP-Server in the Adobe LiveCycle Es? What i have to do? and how can i get user data from the logged user via LDAP? Thank