Execute *.bat in pl/sql
is this possible.
say i have a.sql which will be executing by SQLPLUS
content of a.sql
SELECT count(id)
INTO CTR
FROM table
WHERE_condition;
WHILE CTR>0 LOOP
SELECT paymtnum
INTO PYMT_NO
FROM table2
WHERE id=CTR;
EXEC :='C:\B.BAT ' || PYMT_NO ;
CTR := CTR - 1;
END LOOP;
summary, i wanna call B.bat in a.sql.
please help.
Hi,
you have to use
htp.p('<SCRIPT LANGUAGE="Javascript1.1">
document.all("FORMNAME.DEFAULT.ATTRIBUTENAME.01").value="'||DNAME1||'";
document.all("FORMNAME.DEFAULT.ATTRIBUTENAME.01").value="'||LOC1||'";
</SCRIPT>
instead of
DBMS_OUTPUT.PUT_LINE (DNAME1);
DBMS_OUTPUT.PUT_LINE (LOC1);
where formname is your form name and attribute name is the field name on the page.
Similar Messages
-
Executing *.bat file from PL/SQL
Is there anyway for Executing *.bat file from PL/SQL ?
ThanksTry here:
asktom.oracle.com/pls/ask/f?p=4950:8:15427268967155079552::NO::F4950_P8_DISPLAYID,F4950_P8_CRITERIA:952229840241 -
Executing SSIS packages through SQL Server Jobs.
Hi,
I have an SSIS package which generates xml and text files and ftps it to an ftp site. When i run the package from BIDS it works successfully but when i run it from a job it fails. My SSIS package connects to DB server A and though i'm creating a job on DB
server A but my folder structure and the package resides in server B from where i'm connecting to DB server A through Management Studio. I'm using File system in SQL server Agent Job to call the package. When i execute the job i get following error:
Executed as user: I\A. ...er Execute Package Utility Version 9.00.3042.00 for 64-bit Copyright (C) Microsoft Corp 1984-2005. All rights reserved. Started: 5:08:05 PM Error: 2011-06-21 17:08:05.11
Description: Unable to load the package as XML because of package does not have a valid XML format. A specific XML parser error will be posted. End Error Error: 2011-06-21 17:08:05.11 Description:
Failed to open package file "E:\P\H\R\Tools\R\R\R.dtsx" due to error 0x80070003 "The system cannot find the path specified.". This happens when loading a package and the file cannot be opened or loaded correctly into the XML document. This can be the
result of either providing an incorrect file name was specified when calling LoadPackage or the XML file was specified and has . The step failed.
Could you please tell me where am i going wrong?
Thanks,
Deepti
DeeptiHi Christa Kurschat,
I'm running the job under proxy account. And that account has sysadmin permissions.
I used following script to create proxy account and run my package under that account:
I. Create job executor account
Highlight Security->New Login, say to make login as devlogin, type your password, default database can be your target database.
Server roles: check �sysadmin�
User mapping: your target database
Msdb database: you make sure to include
SQLAgentUserRole, SQLAgentReaderRole, SQLAgentOperatorRole
Then click OK
II. Create SQL proxy account and associate proxy account with job executor account
Here is the code and run it the query window.
Use master
CREATE CREDENTIAL [MyCredential] WITH IDENTITY = 'yourdomain\myWindowAccount', secret = 'WindowLoginPassword'
Use msdb
Sp_add_proxy @proxy_name='MyProxy', @credential_name='MyCredential'
Sp_grant_login_to_proxy @login_name=' devlogin', @proxy_name='MyProxy'
Sp_grant_proxy_to_subsystem @proxy_name='MyProxy', @subsystem_name='SSIS'
III. Create SSIS package
In MS SQL Server Business Intelligence Development Studio, you use job executor account devlogin to create the SSIS package (DTS) and make sure you can execute this package
in SQL Server Business Intelligence Development Studio. Compile/build this package.
IV. Create the job, schedule the job and run the job
In SQL Server Management Studio, highlight SQL Server Agent -> Start. Highlight Job ->New Job�, name it , myJob.
Under Steps, New Step, name it, Step1,
Type: SQL Server Integration Service Package
Run as: myProxy
Package source: File System
Browse to select your package file xxx.dtsx
Click Ok
Schedule your job and enable it
I followed these steps.
Thanks,
Deepti
Deepti -
My coldfusion service crashes intermitantly and when I check
the application logs the error that I see for the time frame is the
one below. Does anyone know where I might begain to solve this?
Thanks!
Error Executing Database
Query.coldfusion.sql.DatabaseConnectionException: Timed out trying
to establish connection The specific sequence of files included or
processed is: E:\wwwroot\lifeworks\default.cfmI'm no expert, but thought I would try to be helpful.
I was getting this same error on a regular basis.
The short term fix was to restart the ODBC server service.
The long term fix was twofold:
1. I recreated the ODBC connection in ColdFusion
Administrator to use the system connection (I was using the SA and
PW for login).
2. I created a second user ODBC connection as well as the
system one under ODBC in Windows Server 2003.
I haven't had the problem since.
I also read a pretty good set of "stuff" to try from the help
area:
http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=tn_17277
Hope this helps. -
Execute a function in SQL Worksheet
How can I execute a function in SQL Worksheet.
The function takes in two parameters of type varchar2 and returns a boolean.
the syntax is:
set serveroutput on
VARIABLE x BOOLEAN;
EXECUTE :x := check_number('78','A');
PRINT x ;
my error is:
SP2-0552: Bind variable "X" not declared.
I have also tried:
set serveroutput on
select check_number('78','A')
from dual;
my error is:
ERROR at line 1:
ORA-06552: PL/SQL: Statement ignored
ORA-06553: PLS-382: expression is of wrong type
thanks.You could even cut out the variable:
SQL> CREATE OR REPLACE FUNCTION is_true
2 ( p1 VARCHAR2
3 , p2 VARCHAR2 )
4 RETURN BOOLEAN
5 AS
6 BEGIN
7 RETURN p1 = p2;
8 END is_true;
9 /
Function created.
SQL> exec dbms_output.put_line(sys.diutil.bool_to_int(IS_TRUE('x','y')))
0
PL/SQL procedure successfully completed.
SQL> exec dbms_output.put_line(sys.diutil.bool_to_int(IS_TRUE('x','x')))
1
PL/SQL procedure successfully completed. -
Executing a bunch of .SQL scripts in a folder ???
hi ,
I have 60+ sql scripts in a folder X..Is there any way to execute these scripts in one go..??
I am searching for a shortcut to execute these scripts using SQL PLUS Scripting (any possible way) ..
Can anyone give some light to solve my issue??
Regards,
johnjpy wrote:
hi ,
I have 60+ sql scripts in a folder X..Is there any way to execute these scripts in one go..??
I am searching for a shortcut to execute these scripts using SQL PLUS Scripting (any possible way) ..
Can anyone give some light to solve my issue??
Regards,
johnls -1 *sql > combined.sql
edit combined.sql and add "@" as first character of every lines
sqlplus scott/tiger @combined.sql -
While executing the following pl/sql block Iam getting following error
While executing the following pl/sql block
Iam getting following error
ORA-06550: line 5, column 11:
PLS-00320: the declaration of the type of this expression is incomplete or malformed
ORA-06550: line 5, column 11:
PL/SQL: Item ignored
declare
TYPE t_customer_details IS REF CURSOR;
o_customer_details t_customer_details;
v_rec o_customer_details%ROWTYPE;
begin
o_customer_details:=pkg_search.fngetcustdetails( 2727,1000841, NULL,NULL,119105329);
LOOP
FETCH o_customer_details INTO rec ;
EXIT WHEN o_customer_details%NOTFOUND;
DBMS_OUTPUT.PUT_LINE(' print' );
END LOOP;
CLOSE o_customer_details;
end;sorry
declare
TYPE t_customer_details IS REF CURSOR;
o_customer_details t_customer_details;
begin
o_customer_details:= pkg_search.fngetcustdetails( 2727,1000841, NULL,NULL,119105329);
FOR v_rec IN o_customer_details
LOOP
DBMS_OUTPUT.PUT_LINE(' print' );
END LOOP;
END;I changed code,
Can you say , o_customer_details:= pkg_search.fngetcustdetails( 2727,1000841, NULL,NULL,119105329); is it right?
pkg_search.fngetcustdetails return ref cursor?? -
Whats the difference between executing a package from SQL and Visual Studio?
Hi,
We have a package that is currently failing to run when deployed to SQL. This has been tried from a schedule and also executed manually both are failing.
I have tried from Visual studio running on various machines (windows 8, server 2012) and in all cases run perfectly.
I am trying to understand the differences between deploying to SQL and running from VS so maybe I can figure out why this is happening.
I have the following errors when I run from SQL.
DTS_E_PROCESSINPUTFAILED - all errors like this point to the 'Sort' tasks in the script
dts_e_processinputerror not enough storage is available
I have tested in four environments and all fail from SQL but not from VS!
Last night I tried from my laptop and executed the package from SQL - it didn't fail but was still running in the morning so I terminated. Note this takes around 20 mins running from VS! why would it be so quick from VS but fail or take so long on SQL?
The test running at the moment is on a server with dynamic memory currently at 14GB. I decreased SQLs RAM to 4GB and it hasn't failed yet but has been running for two hours. Before changing this the package failed after a short time.
I thought it may have something to do with running from a virtual machine but doesn't explain why it couldn't run locally on my laptop.
All ideas welcome :) Many thanks,
DavinaI will try to address issues one by one
The error doesn't seems to be related to SSISDB configuration mode. It may be because of
Change in package definition (please confirm that the package which you are running on your laptop is the same on your msdb? - reload your SQL package from MSDB in BIDS/SSDT and recreate your source and destination components)
As your error message shows, "not enough memory available" (may be because of multicast) - Usually you can override this error by restarting SQL Server [not an optimal solution but it work & if that work it shows that your package fills
the memory - Keep an eye on task manager]
Make sure that your statics on table are updated [run EXEC sp_updatestastics]
Make sure your indexes are not de-fragmented [run rebuild indexes]
If you are dealing with many rows may be 40000 * 12 (because of multicast) = 4,800,000 rows the try to separate package.
Check your excel file format/column data type is correct
Check user permission who is running the job has required permission on folder/file.
Understand that sort is a blocking transformation and it requires all your data in memory before it sorts. so, if there are large number of rows then your complete memory will be occupied.
Difference between Visual Studio & BIDS/SSDT
Nothing much, other than BIDS runs on 32 bit while jobs on 64 bit (but there run time environment are configurable, though)
There shouldn't be any performance difference until your
package is on network location because transferring data to the network may slow the package. If package runs on SQL Server it uses SQL buffer pool to fetch data via SQL statement and then SSIS works on its own memory allotment.
Hope this will help you to understand and fix the issue.
Glad to help! Please remember to accept the answer if you found it helpful. It will be useful for future readers having same issue. -
ERRORs executing CWM commands in SQL Plus
Hi,
I tried to execute following command in SQL Plus:
execute cwm_olap_dimension.set_plural_name('olapdata', 'OLAP_APARAT_DIM', 'OLAP_APARAT_DIM');
And in response I got following result:
BEGIN cwm_olap_dimension.set_plural_name('olapdata', 'OLAP_APARAT_DIM', 'OLAP_APARAT_DIM'); END;
ERROR at line 1:
ORA-06510: PL/SQL: unhandled user-defined exception
ORA-06512: at "OLAPSYS.CWM$UTIL", line 535
ORA-06512: at "OLAPSYS.CWM$OLAP$DIMENSION", line 17
ORA-06512: at line 1
Can anyone explane me what am i doing wrong ?
I would really appreciate any help!
Thankscheck SQL*Plus user's guide
e.g column REMARK format a30
set linesize 2243
etc etc etc -
How Execute a very long SQL in a Storep Procedure inside a String?
How Execute a very long SQL in a Storep Procedure inside a String?
I have a very very long sql in a String , How can I run this SQL?
Thaks in advance.Xavi wrote:
I have a very very long sql in a String , How can I run this SQL? Version? If you are on 11g, dynamic SQL can be a CLOB. If you are on older versions us DBMS_SQL package.
SY. -
Execute (or re-execute) commands in the SQL*Plus buffer
I feel confused about sql plus / command. by defination, it Execute (or re-execute) commands in the SQL*Plus buffer. how do I know whether it execete or re-execute a command?
for example, I run a select statement, seems I have to type / to get result. when I run a create table statement, it seems run twice with / and I got table exists error.
Could someone clearify when should / be used and when not to use it.jz2 wrote:
I feel confused about sql plus / command. by defination, it Execute (or re-execute) commands in the SQL*Plus buffer. how do I know whether it execete or re-execute a command?
for example, I run a select statement, seems I have to type / to get result. when I run a create table statement, it seems run twice with / and I got table exists error.
Could someone clearify when should / be used and when not to use it.I guess you are looking at things in the other way round. The / does what it says, it executes the command in the buffer. Don't think it "reexecutes". It simply executes the command. Be it already run or for the first time. For example,
Running the code for 1st time.
SQL> begin
2 dbms_output.put_line('hi');
3 end;
4 .
SQL> set serveroutput on
SQL> /
hi
PL/SQL procedure successfully completed.
Running again....
SQL> l
1 begin
2 dbms_output.put_line('hi');
3* end;
SQL> /
hi
PL/SQL procedure successfully completed.
SQL>So / simply executes. Now when you should use it and when not, that depends upon the kind of command you are trying to execute. Like you mentioned, for a select, it works by again giving the output. But for a DDL, its not the / which gives error but its the very nature of DDL that once issued, its committed so surely enough , next execution would throw an error only.
HTH
Aman.... -
How to execute .bat file within pl/sql block
Hi,
I want to execute a batch file (.bat) file withing a pl/sql procedure. Please guide me for it.
RegardsThere are several possible ways to make a call-out from a PL/SQL program to the OS on the database server (but not to the client computer).
You could use java or an external procedure (you'll need to code it in C) for example.
You might be able to make use of UTL_HTTP to talk HTTP to another server or UTL_TCP to talk TCP to another server.
What is it you are trying to do? -
Execute .Bat file from pl/sql code
Hi,
Can you please let me know that how can I execute the .Bat file from pl/sql procedure? Does anybody have a sample code??
Thanks.Hi
This may help you
http://www.dba-oracle.com/t_running_windows_bat_file_dbms_scheduler.htm
br,Jari -
Error when execute a package from SQL Server Agent
We have the next problem:
When we execute a package from a Job of SQL Server agent, it shows the success messege, but reviewing the results, the package didnt do all the tasks.
When we run it mannually by MSIS the package, it shows the success message and it works fine.
The workflow of the package is :
1) Shrink the databases (executing a sql file)
2) Backup the databases (Back up Database task of MSIS)
3) Rename the files to .BAK extension (by the Foreach loop container and fyle system task)
4) Execute command to compress the it (by a .bat)
5) Move the compress file to another location (by another Foreach loop)
Manually run correct, but when is a a SQL AGent Job that execute the package it does only the first 2 steps.
we are ussing Microsoft SQL Server 2008 R2 (SP1) - 10.50.2500.0 (X64) Jun 17 2011 00:54:03 Copyright (coffee) Microsoft Corporation Enterprise Edition (64-bit) on Windows NT 6.1 <X64> (Build 7601: Service Pack 1)
We are using a user with administrator privilegies
CheersCan you check if account running package has proper access. You may need to define a proxy account for that.
See
http://www.databasejournal.com/features/mssql/article.php/3789881/Proxy-Accounts-in-SQL-Server.htm
http://gqbi.wordpress.com/2014/01/30/setting-up-a-proxy-account-to-run-sql-server-integration-services-ssis-2012-packages/
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
Execute immediate and dynamic sql
Dear all;
Just curious....Why do developers still use dynamic sql..and execute immediate, because I always thought dynamic sql were bads and the use of execute immediate as well...
or am I missing something...There are no 'bad' things and 'good' things.
There are 'correctly used' and 'incorrectly used' features.
It depends what you want to do.
One simple example: Oracle 11.2 - you write a package that fetches data from range interval partitioned table (a new partition is created automatically every day when new key values are inserted). If you use static SQL then whenever Oracle creates a new partition then your package gets invalidated and has to be compiled. If your package is heavily used (by many sessions running in parallel) then you may get this:
ORA-04068: existing state of packages has been discarded
ORA-04061: existing state of package body "PACKAGE.XXXXX" has been invalidated
ORA-06508: PL/SQL: could not find program unit being called: "PACKAGE.XXXXX" Nice, isn't it?
You can avoid this kind of problems by simply using dynamic SQL. You break dependency with the table and your package is not invalidated when new partition is created.
Maybe you are looking for
-
Integration MIRO error, how to determine the VST related accounts.
integration Miro error. Hi gurus, please resolve the problem urgent. while doing MIRO Iam getting the following error. after given PO number in MIRO I getting the following error. please how to resolve the problem. where i can determin the accounts,
-
Error on installing updates to Dreamweaver CS6
I am running Dreamweaver CS6 v12.0 and I was checking to see if there were any updates available. I located three of them on the downloads page and proceeded to try to install the next version up from mine. It downloaded and I ran the installer, ho
-
ITunes and other programs hang after starting...
Hello everyone, Programs effected: iPhoto Adobe Acrobat iTunes (Only when I open the iTunes Store) Problem: After about a minute, the program will hang and become unresponsive (pinwheel) but will not crash. I have to shutdown the program manually. Th
-
Customization / personalization of self service pages ... R12
Hi All! I have got experience in customization and personalization of Apps forms which are based on Form Builder (FMBs) but I have no experience in customization or personalization of self service based forms. Can anybody please guide me the steps to
-
I connected my ipod touch to a netbook to try and play music when i disconnected the ipod my music would not play all it does is stay at 0:00 ive tried restarting it than i tried to restoring it but nothing seems to work what can i do?