Executing consub statement via a file.
I've produced a file with a CONSUB Statement. And this file was produced using Spool using dbms_output.put_line statements.
The Consub statement is a valid concurrent request (if i copied the statement into unix it will run), however, it says that i am giving the wrong number of parameters if i run the statement by execulting the file.
I am think it is because the dbms_output automatically beaks the consub statement into a new line after a set number of charaters and unix doesn't like the carrage return.
1) 255 bytes per line
http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96612/d_outpu2.htm#1000446
2) Create a directory object where you specify the path (on the database server)
To test wether a file exists, try to open the file in read mode.
http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96612/u_file.htm#ARPLS069
Similar Messages
-
How to export the result from executing sql statement to excel file ?
HI all,
Great with Oracle SQL Developer, but I have have a trouble as follwing :
I want to export the result from executing sql statement to excel file . I do easily like that in TOAD ,
anyone can help me to do that ? Thanks so much
SigmasvnHello Sue,
I just tried to export to excel with the esdev extension and got java.lang.NumberFormatException. I found the workaround at Re: Windows Multi-language env, - how do I set English for application lang?
open the file sqldeveloper\jdev\bin\sqldeveloper.conf and add the following two lines:
AddVMOption -Duser.language=en
AddVMOption -Duser.country=USyet now my date formats in excel are 'american-style' instead of german. For example 01-DEC-01 so excel does not recognize it as date and therefore I can not simply change the format.
When export to excel will be native to 1.1 perhaps someone can have a look at this 'feature'
Regards
Marcus -
Execute commands/statements in txt file supplied to plsql procedure
Hi,
I need to execute commands which are in txt file , this txt filepath is supplied to the procedure.
In the procedure i want to open the txt file and read the commands and run the commands.
Please help on this .
Edited by: 904032 on Jun 26, 2012 12:02 AMThe fact that you are supplying a file path (more correctly known as a directory) is going to be your first problem. Security within Oracle means that access to files on the file server require a directory object to be specified and these directory objects refer to a specific directory on the file server. If you're going to be passing different directories into your procedure then you're going to have to have different directory objects set up for all the possible directories that can be accessed (or issue dynamic DDL to redefine a known directory object each time).
Once you've done that you can use the UTL_FILE package (http://docs.oracle.com/cd/E11882_01/appdev.112/e25788/u_file.htm#ARPLS70906) to read the contents of the file as lines.
Then it depends what you mean by "commands" and "statements". Are you referring to operating system commands?... If so you will need to use something like the DBMS_SCHEDULER package to issue a job to run immediately with the appropriate command, as that is able to issue operating system commands, or you are going to have to write some Java code to issue commands for you (plenty of examples if you google). OR, perhaps you are referring to SQL statements? These could possibly be issued using the PL/SQL execute immediate statement, but you will be leaving your database open to SQL injection and major security issues, something that most companies would consider a serious flaw and not want.
how to read string which is delimited by ';'. or how read each charater in a file ..About time you read the documentation (http://tahiti.oracle.com/). There are functions: SUBSTR and INSTR which can search for things in strings and extract parts of strings, or you can use the more advanced regular expression versions of those REGEXP_SUBSTR and REGEXP_INSTR, or even REGEXP_REPLACE (which is also good for extracting parts of strings).
If you want a more concise answer, you need to ask a more concise question... {message:id=9360002} -
How to execute sql statement under bat file?
I want to execute following statement
C:\>sqlplus /nolog
SQL> conn scott/tiger
SQL> select * from tab;
I know I can realize it as following test.bat and testdb.sql file
test.bat is follows:
sqlplus /nolog @testdb.sql
testdb.sql is follows:
conn scott/tiger
select * from tab;
Now I don't want to use sql file,I only want to use bat file,like follows:
test.bat is follows:
sqlplus /nolog
conn scott/tiger
select * from tab;
when I run test.bat,I find only sqlplus /nolog statement execute,the other statements don't execute.
1)I want to know whether there is a method to execute sql statement only by bat file without a sql file? How to realize it?
2)If I call sql file,how to hide passord of user? Because I don't want to other persons know scott password,if I use conn scott/tiger in testdb.sql,other person can see testdb.sql and know the password. Is there a good method to avoid?
Thanks!I'm running *NIX, but works the same on Windows
bcm@bcm-laptop:~$ cat here.sh
sqlplus dbadmin/admindb << EOF
select count(*) from user_objects;
exit
EOF
bcm@bcm-laptop:~$ sh here.sh
SQL*Plus: Release 11.2.0.1.0 Production on Mon May 17 18:14:09 2010
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL>
COUNT(*)
9
SQL> Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
bcm@bcm-laptop:~$ Edited by: sb92075 on May 17, 2010 6:15 PM -
Run sql statement from batch file
How can we execute SQL Statement using Batch file???
I did a test.
create batch file test.bat
sqlplus "username@db /pass" @\script.sql
script.sql file has following statement
select sysdate from dual;
exit
it is working but I want to call sql statement in the same batch file instead of calling .sql script file. how can I do that any idea..This is very easy in unix shell scripting, but AFAIK, not available with Windows. It's a function of how the shell/command processor handles input redirection.
-
How to execute entire result set of multiple sql statements via sp_executesql?
I have a query that generates multiple insert statements (dynamic sql). So when I execute this my result set is a table of sql insert statements (one insert statment per row in my source data table). Like so:
Select 'INSERT INTO [dbo].[Table_1] ([Col1]) VALUES (' + SrcData + ')' from SourceDataTbl
How can I completely automate this and execute all these sql statements via sp_executesql?
My plan is to completely automate and execute all this via an SSIS package.
As always any help is greatly appreciated!
fyi- This is a very simple version of what I am trying to do. My query probably plugs in 20+ values from the SourceDataTbl into each of the sql insert statements.Ah, a small error in Visakh's post, which I failed to observe, and then I added one on my own.
DECLARE @SQL Varchar(max)
SELECT @SQL =
(SELECT 'INSERT INTO [dbo].[Table_1] ([Col1]) VALUES (' + SrcData +
')' + char(10) + char(13)
from SourceDataTbl
FOR XML PATH(''), TYPE).value('.', 'nvarchar(max)')
EXEC sp_executesql @SQL
Without ", TYPE" FOR XML returns a string when assigned to a variable. The TYPE thing produces a value of the XML data type, so that we can apply the value method and get string out of the XML.
And why this? Because:
DECLARE @str nvarchar(MAX)
SELECT @str = (SELECT 'Kalle Anka & co' FOR XML PATH(''))
SELECT @str
SELECT @str = (SELECT 'Kalle Anka & co' FOR XML PATH(''), TYPE).value('.', 'nvarchar(MAX)')
SELECT @str
Although the data type is string when , TYPE is not there, it is still XML and characters special to XML are enticised.
Confused? Don't worry, for what you are doing, this is mumbo-jumbo.
Erland Sommarskog, SQL Server MVP, [email protected] -
Batch executing SQL Statements stored in a file in SAP DB
hi,
I am using SAP DB as database in my j2ee application. As a part of the application purpose, i need to insert a large no. of records in to the database directly. I have created the SQL file which contains the insert statements for the records
Now i need to execute this file sothat the insert statement which are inside the file get executed. I am using SQL Studio to access to the Database.
I would like to know whether any options are available in SQL Studio to for executing a SQL File.
Kindly help
Best regards,
Sudheesh...Hi,
I believe that the solution to your problem lies in creating sql studio objects.Please refer to the link below.Select the link "sql dialog" on the page.
The following options are available for sql dialog.
The following options are available in the SQL dialog:
· Creating and executing SQL statements
· Setting parameters for SQL statements
· Importing and exporting SQL statements
Select the "Importing and exporting sql statements" link on this page to know more about it.This will tell you how to import sql statements from ascii files.
Basically,what you need to do is From the context menu for the SQL dialog, choose Import File or Export File.
The link I have provided,gives a lot of other information as well.
http://help.sap.com/saphelp_nw04s/helpdata/en/ee/1c5bdfeba711d4aa2800a0c9430730/frameset.htm
Hope this helps.
Regards,
Harish
(Please award points for helpful answers)
Message was edited by: HARISH SUBRAMANIAN -
CASE not found while executing CASE statement on Submit Form
Hi to all APEX users and developers.
I have several APEX applications and they are all working well, but recently I got one strange exception when I try to submit page:
Session: Fetch session header information
...metadata, fetch page info
...Validate item page affinity.
...Validate hidden_protected items.
Add error onto error stack
...Error data:
......message: Error processing request.
......additional_info: ORA-06592: CASE not found while executing CASE statement
......display_location: ON_ERROR_PAGE
......is_internal_error: true
......apex_error_code: APEX.UNHANDLED_ERROR
......ora_sqlcode: -6592
......ora_sqlerrm: ORA-06592: CASE not found while executing CASE statement
.....error_backtrace: ORA-06512: at "APEX_040100.WWV_FLOW", line 9273
......component.type: APEX_APPLICATION_AUTH
......component.id: 41350431648668800
......component.name: MNRFR
...Show Error on Error Page
......Performing rollback
Processes - point: AFTER_ERROR_HEADER
Processes - point: BEFORE_ERROR_FOOTER
End Page Processinga
Page has more than 120 items (most of them are hidden), so my first thought is that page has problem with posting so many items, but APEX error message doesn't hel me at all. Any help would be very appreciated :)
AlmirHi Almir,
actually it is the 100 page item limit. See (http://download.oracle.com/docs/cd/E17556_01/doc/user.40/e15517/limits.htm)
I also had a look into the source code and the code at the position where the error gets raised only supports 100 page items.
Can you have a look into the generated HTML code and look if you have a page items which is mapped to p_t101 or a higher number ?
I will file a bug to show a better error message.
Regards
Patrick
My Blog: http://www.inside-oracle-apex.com
APEX Plug-Ins: http://apex.oracle.com/plugins
Twitter: http://www.twitter.com/patrickwolf -
Executing SUBMIT statement in background
Hello Experts,
Is it possibe in executing SUBMIT statement in backgound? If yes can anyone provide example code?
Also in terms of performance tuning how does SUBMIT fares against CALL TRANSACTION? Which is much better in terms of performance.
Appreciate your answers. Thanks!Hi
There's no difference for the performance:
if a transaction is assigned to a report (so no dialog program, module pool), it's better to use the SUBMIT if it needs to transfer the value on SELECTION-SCREEN. It can't do it by CALL TRANSACTION.
DATA: VA_JOBNAME LIKE TBTCO-JOBNAME,
VN_JOBCOUNT LIKE TBTCO-JOBCOUNT.
* Open job
CALL FUNCTION 'JOB_OPEN'
EXPORTING
JOBNAME = VA_JOBNAME
IMPORTING
JOBCOUNT = VN_JOBCOUNT
EXCEPTIONS
CANT_CREATE_JOB = 1
INVALID_JOB_DATA = 2
JOBNAME_MISSING = 3
OTHERS = 4.
CASE SY-SUBRC.
WHEN 0.
WHEN OTHERS.
MESSAGE E208(00) WITH 'Error.
ENDCASE.
* Call report
SUBMIT <REPORT> USER SY-UNAME
VIA JOB VA_JOBNAME NUMBER VN_JOBCOUNT
WITH ..................................
AND RETURN.
* Close job
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
JOBCOUNT = VN_JOBCOUNT
JOBNAME = VA_JOBNAME
STRTIMMED = 'X' " start immediatly
EXCEPTIONS
CANT_START_IMMEDIATE = 1
INVALID_STARTDATE = 2
JOBNAME_MISSING = 3
JOB_CLOSE_FAILED = 4
JOB_NOSTEPS = 5
JOB_NOTEX = 6
LOCK_FAILED = 7
OTHERS = 8.
Max -
Possibility to execute Acrobat Pro's "Combine files into PDF" function from within SAP?
Good day.
Presently, a company uses Acrobat Pro to manually combine files such as *.pdf, *.jpg, *.doc, which have been downloaded from SAP's Document Management System, into one pdf file. I would like to know if it is possible to automatically execute Acrobat Pro's "Combine files into PDF" function from within SAP (ECC 6.0) application system. I'm wondering if this could be achieved from a program via OLE (Object Linking and Embedding) or RFC (remote function call).
Thanks in advance for your thoughts and inputs.Yes, you can combine PDF files via IAC/COM methods.
-
Hi,
Can anyone see why I am getting this error message for my SQL query?
WITH SKU_DATA AS (
SELECT /*+ MATERIALIZE */ DISTINCT FROM_LOC_ID,
SKU_ID,
DESCRIPTION,
UPDATE_QTY,
ORDER_ID,
CONSIGNMENT,
WEIGHT,
PALLET_ID,
CASE
WHEN Upd_Qty_Ratio < 1
THEN TO_CHAR(UPDATE_QTY) || 'U'
WHEN TRUNC(Upd_Qty_Ratio) = Upd_Qty_Ratio
THEN TO_CHAR(Upd_Qty_Ratio) || 'C'
ELSE TO_CHAR(TRUNC(UPDATE_QTY)) || 'C' || ' ' || TO_CHAR(ROUND(MOD(Upd_Qty_Ratio, 1) * USER_DEF_NUM_3, 6)) || 'U'
END CU_Sum
FROM (
SELECT DISTINCT
FROM_LOC_ID,
S.SKU_ID,
S.DESCRIPTION,
ITL.UPDATE_QTY,
S.USER_DEF_NUM_3,
OH.ORDER_ID,
ITL.CONSIGNMENT,
ITL.PALLET_ID,
NVL(ITL.UPDATE_QTY,0)*NVL(S.EACH_WEIGHT,0) Weight,
ITL.UPDATE_QTY/(CASE S.USER_DEF_NUM_3 WHEN 0 THEN 1 ELSE S.USER_DEF_NUM_3 END) Upd_Qty_Ratio
FROM INVENTORY_TRANSACTION ITL, SKU S, LOCATION L, ORDER_HEADER OH
WHERE ITL.SKU_ID = S.SKU_ID
AND ITL.CODE = 'Pick'
AND ITL.CONSIGNMENT = $P{Consignment}
AND OH.ORDER_DATE = TO_CHAR($P{Date}, 'DD-Mon-YYYY')
AND OH.ORDER_ID = ITL.REFERENCE_ID
AND ITL.TO_LOC_ID = 'CONTAINER'))
SELECT DISTINCT ORDER_ID, CONSIGNMENT, WEIGHT, PALLET_ID, CU_Sum,
(SELECT NVL(TO_CHAR(SUM(CASE WHEN NULLIF(SUBSTR(Cu_Sum, -1), 'U') IS NULL THEN NULL ELSE REPLACE(Cu_Sum,'C',NULL) END)),'0') ||'C' || ' ' || NVL(TO_CHAR(SUM(CASE WHEN NULLIF(SUBSTR(Cu_Sum, -1), 'C') IS NULL THEN NULL ELSE REPLACE(Cu_Sum,'U',NULL) END)),'0') ||'U' FROM SKU_DATA) AS Total_Cu_Sum
FROM SKU_DATAThanks in advance.
SM.Hi Sean,
It is saying error executing SQL statement, but with no "ORA error" so maybe its a Jasper Reports error i'm not too sure.
And this is a different version of the one we done together, that one is running fine just having problems putting the jasper file on to the server. I'm just using the main bits from the original SQL.
SM -
Load sql statement in .bat file
Hi
I need to execute a simple sql command eg: +"truncate table tab1"+ from a DOS batch file...
my bat file contains following statement
sqlplus dilanjan/dilanjan@XE @trun.sql
my trun.sql file contains following statement
truncate tabe base
once I save the .bat file and double click it. It connects to database but the table is not getting truncated...
Some one please help me with this!What does your screen output show you.
Did you try to execute the statement in the batch file manually?
Are the files in the same directory?
Please post some screen output
Thanks
FJFranken -
Execute photoshop script via illustrator cs5
Hi
Is it possible to execute Photoshop script via illustrator
I have 2 different script
script 1 work in illustrator with eps file and export as jpeg
script 2 where i want to trim the exported jpeg for illustrator in photoshop and save it back
I have 2 differnt script with me
can anyone help me to club both and run at same time..
Thank you
Appuuse BridgeTalk to have Illustrator talk to Photoshop, here's a sample by Mark
Illustrator script to open file in Photoshop
or use inter app communication
open PS, open a document
// start your illustrator script
var Aidoc = app.activeDocument;
continue with your script
// when ready, call your photoshop script
// this sample alerts the active document name and closes it
photoshop.executeScript("alert('document name: ' + app.activeDocument.name); app.activeDocument.close()"); -
Difference between running a java application as jar or via batch file?Hi,
Hi,
I'm facing some strange differences in the behavior of my application , only caused by different methods to execute the application . So I have know the potential difference between these methods to locate the error.
1) running my application it with java -jar (via batch-file or command-prompt) or in eclipse works fine
2) executing the jar by double click causes problems.
The difference I know are that you can easily pass arguments to jvm, when using the jar.Maybe there is a differences in thread scheduling, but I'm not sure about that.
Can anyone tell me, the differences between these to methods of execution?
Thanks a lot in advance.
Greetings MichaelHi,
to get a clue I have redirected the System.err and System.out to a TextArea
(see code below) and suddenly the error was gone. So according to the behavior that it had worked before in the ide and via batch file where the System stream can do unlimited writing. I think it is obvious, that something goes wrong with streams of System.
Does anyone knows what happens to messages which are send to the default streams, when running the app as jar? I normally would assume that they would point to /dev/null or something else, but as I have experienced it seems that they are blocking after a certain amount, which prevented my app from working. (By the way invoking it with javaw has the same effect.)
This goes a little bit off topic, perhaps I should post a new thread.
But this is a huge difference between java and and javaw (jar), I wasn't aware of i t until now.
Hope someone can explain me how javaw handles System.err and System.out.
Thanks for your participation.
Greetings Michael
@SuppressWarnings("unused")
private static void debug(){
/* Debug Jar-File if no console exists */
final JTextArea ta = new JTextArea(25, 80);
ta.setWrapStyleWord(true);
final JScrollPane jscp = new JScrollPane(ta);
class TextAreaPrintStream extends PrintStream {
private JTextArea consoleTextArea;
TextAreaPrintStream(JTextArea consoleTextArea, OutputStream out) {
super(out);
this.consoleTextArea = consoleTextArea;
/* (non-Javadoc)
* @see java.io.PrintStream#println(java.lang.String)
@Override
public void println(String x) {
this.consoleTextArea.append(x +'\n');
/* (non-Javadoc)
* @see java.io.PrintStream#print(java.lang.String)
@Override
public void print(String s) {
this.consoleTextArea.append(s);
TextAreaPrintStream out = new TextAreaPrintStream(ta, System.out);
TextAreaPrintStream err = new TextAreaPrintStream(ta, System.err);
System.setOut(out);
System.setErr(err);
JDialog dialog = new JDialog( (Frame) null, "Log" , false);
dialog.setContentPane(jscp);
dialog.setSize(dialog.getPreferredSize());
dialog.setVisible(true);
System.err.println("Test Error");
Used proposed solution from sn.schulz :
http://forum.java.sun.com/thread.jspa?forumID=257&threadID=213477 -
Executing powershell script via task scheduler
Hello,
I am trying to execute powershell script via windows task scheduler which will forcefully delete all email in a mailbox, but I am getting the below errors
Operational Code - 2
Task Category - Action Completed --- Task Scheduler successfully completed task "\IL98" , instance "{2b193375-cbd2-4986-918d-3cfd4027d6b6}" , action "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" with return code 0.
Last Run Result - 0X0
When I am adding additional cmdlets in the script "Set-ExecutionPolicy Unrestricted", I am getting Last Run Result 0X5 rest of the error remains the same.
Powershell version - 3.0
Task Scheduler version - 1.0
If I try to run the script manually via Exchange Powershell the script executes without any errors
Thanks in Advance,
Ankush ShahI figured out the problem, there wasn't any problem with the script but I had to correct inputs in windows task scheuler
Below is the resolution:
Under Actions:
Program/Script --> ws\System32\WindowsPowerShell\v1.0\powershell.exe
Add Argument --> -noexit -command ". 'C:\Program Files\Microsoft\Exchange Server\V14\bin\RemoteExchange.ps1'; Connect-ExchangeServer -auto
; <filepath>"
Eariler I was writing the filepath after double quote "
Also I have selected the option "Run with Highest Privilages" to avoid
0x5 error
Maybe you are looking for
-
Please Help - I want to use my iPod : (
Here is the problem: A few months ago my iTunes no longer recognized my pod even though my computer did. I went through Apple's suggestions, reinstalling software/iTunes to no avail. I reset my pod to factory settings, but it would still not be recog
-
Hide/show a column for some users in SSAS tabular
Hi, I have a requirement to show one of the columns in a table only to some of the users. I know SSAS tabular only supports row level security. The only solution I came up with yet is to create two different models. Unfortunately this wastes a lot of
-
Moving Around in Numbers Like in Excel
In Excel you can CTRL-arrow to move to the next blank cell in any direction or SHIFT-CTRL-arrow to select all cells between where you are and the next blank cell in any direction. Is there a similar keystroke in Numbers? If so, I haven't found it yet
-
URGENT! Need this TONIGHT!
URGENT! Need this TONIGHT! Posted: Dec 8, 2005 6:48 AM Reply Email I am in dire straits! I have to show (and have 10 copies) of my DVD for a soccer banquet TONIGHT! I have made many DVDs before and never had this happen. I am getting the following er
-
I have just taken delivery of 2 Nokia 5800s, one form Orange and one from Three. The wifi network I will be connecting to most often controls connectivity via a list of approved MAC adresses (the access point is a cisco WAP4410N). When entering the 5