Spool filename append
Hey Everyone,
I am using oracle version: 9.2
I wanted to know if spool filename append command is available?
I want to display the query results on an html page that has a calender i have created using javascript. And not to spool the output to a new html page but to an already existing one. how to do so?
spool is a sqlplus command. Which means you can use a 10g or 11g client to query your 9iR2 database.
Similar Messages
-
Hi experts,
Oracle version 10G
Am trying to connect from my unix machine if am giving "sqlplus -V" it is showing me 9.2 version
my question is if am useing spool with append as bellow
SPOOL <path/filename.log APPEND
select statements
SPOOL OFF
it is not creating any log file in said path why is it like this ? hwo can i get this Append featuer ? is this version issue?
Many thanks,
KalingaHi,
Kalinga wrote:
... hwo can i get this Append featuer ? is this version issue?Yes, SPOOL ... APPEND was introduced in SQL*Plus 10.
It doesn't matter what version of the database you have; SPOOL is a SQL*Plus feature. -
Hi,
when ever i run the script, it is generating output to spool. but every time when i run the script it is appending the old spool.
It is not generating the new spool request. we are working in ECC 6.0
Any clue?Hi,
Do you have a z Print program for your script???
If yes.. Then found where are you calling OPEN_FORM ..
There is a Parameter in this form called OPTIONS ,, Pass here *TDNEWID = 'X' * .. It will always generate a new spool request for your form..
Code like below..
data : s_itcpo type itcpo.
s_itcpo-tdimmed = 'X'.
s_itcpo-tddelete = 'X'.
s_itcpo-tdnewid = 'X'.
s_itcpo-TDNEWID = 'X' " here a new spool request parameter is set
* Display one dialog for user. Then enable several SAP-Script
call function 'OPEN_FORM'
exporting
device = 'PRINTER'
dialog = 'X'
language = sy-langu
options = s_itcpo ----- > here is the structure
importing
language = sy-langu
exceptions
canceled = 1
device = 2
form = 3
options = 4
unclosed = 5
others = 6.
Edited by: Lokesh Tarey on Jul 16, 2010 12:16 PM -
Spool filename that contains spaces
Hi Folks,
Does anyone know a technique for creating spool files that
contain spaces in the path name?
I have a script that I want to pass in a directory path as a
parameter. The script then uses this directory as the path for
dynamically created scripts which are run later in the main
script, but SQL*Plus won't allow spaces in the path name.
e.g.
myScript.sql
DEFINE P_DIR = '&1'
SPOOL &P_DIR.script1.sql
-- Dynamic SQL statements
SPOOL OFF
@&P_DIR.script1.sql
Called by plus80 @myScript 'C:\Documents and Setting\andy\'
I've tried various combinations of single and double quotes
around the variable references and even tried a HOST cd &P_DIR
command, all to no avail. I'm sure I've seen this done
somewhere before.
BTW Using a batch file is not a possible solution :(
Any help would be much appreciated.
Regards
AndyThis is logged as a SQL*Plus bug, #898051. It used to work in SQL*Plus 3.
If you have access to MetaLink http://metalink.oracle.com/ you can view the complete text of the bug.
-- CJ -
Spooling queries output to text file
Hi All,
I need help to spool the output to a text file for a sequence of queries that I need to execute.
Lets say, the queries would in a sql file as follows:
Select * from emp where empId = 1
Select * from emp where empId = 2
Select * from emp where empId = 3
The output in txt file should have the details as
Employee Id Employee Name Employee Designation
1 Alex Manager
2 Conrad Sr Manager
3 Herman Technical architect.
I am trying to execute this from sql developer.
Any pointers in this regard would be highly helpful.Hi,
Welcome to the forum!
Why not use just one query
SELECT *
FROM enp
WHERE empid IN (1, 2, 3)
ORDER BY empid
You can use "SPOOL filename APPEND" to re-open and add to an existing spool file after it has been closed, but there's no need to in this case. -
Append new records for a spool file
Hello,
I am running a query and sending the output to a spool file.
The query never returns the same data because it is run every 2
hours
How can I make the spool to append the new records and not
overwrite the old records?
Thanks
CarlosSPOOL.SPO[OL] [filename[.ext]|OFF|OUT]
Oracle documentation provides no indication that any append
functionality exists for the sql*plus command SPOOL.
I can recommend two solutions:
1. Spool to a temporary file in sql*plus, then perform a
concatenation using the OS. Automate the process with a shell
script (or batch file, as the case may be).
2. Write the file using DBMS_OUTPUT.
-Kevin -
Hi friends,
i am using oracle 9.2.0.4.0. Totallly i have 9 instances (5 in windows 2000 and remaining in linux)... I need to take some reports from my all databases weekly basis... i dont have idea to append the results into spool file. Can you please give me the idea to create single output file instead of nine files? (Can i append the all the result into single file is any option?) please guide me...
Regards,;
KarthikCan this help for you ?
Re: spool/save append? -
How to append timestamp to log file in SQL*Plus ?
Version: 11.2.0.3
Platform : RHEL 5.8 (But I am looking for platform independant solution)
I want to append the timestamp to spooled log file name in SQL*Plus.
The spooled log filename should look like
WMS_APP_23-March-2013.logI tried the following 3 methods found in the google. But none of them worked !
I tried this
col sysdt noprint new_value sysdt_var
SELECT TO_CHAR(SYSDATE, 'yyyymmdd_hh24miss') sysdt FROM DUAL;
spool run_filename_&sysdt_var.Logas suggested in
http://power2build.wordpress.com/2011/03/11/sqlplus-spool-name-with-embedded-timestamp/
and this
spool filename with timestamp
col sysdt noprint new_value sysdt
SELECT TO_CHAR(SYSDATE, 'yyyymmdd_hh24miss') sysdt FROM DUAL;
spool run_filename_&sysdt..Logas suggested in
http://powerbuildev.wordpress.com/2011/03/11/sqlplus-spool-name-with-embedded-timestamp/
and this
column tm new_value file_time noprint
select to_char(sysdate, 'YYYYMMDD') tm from dual ;
prompt &file_time
spool logfile_id&file_time..logas suggested in
Creating a spool file with date/time appended to file name
None of the above worked in RHEL or MS DOS. Any workaround ?I have tested your suggestions. But I still couldn't append the date to the logfile in RHEL or MS DOS SQL*Plus
Here are the attempts I've made. I am posting how the logfile looked like after every test.
#Attempt1 with two dots (&sysdate..log )
set echo on
set feedback on
set define off
set pages 999
column dcol new_value SYSDATE noprint
select to_char(sysdate,'YYYYMMDD') dcol from dual;
spool testlog.&sysdate..log
select 'hello' from dual;
spool off;Log File Name -- > testlog.&sysdate..log
#Attempt2 with single dot (&sysdate.log)
set echo on
set feedback on
set define off
set pages 999
column dcol new_value SYSDATE noprint
select to_char(sysdate,'YYYYMMDD') dcol from dual;
spool testlog.&sysdate.log
select 'hello' from dual;
spool off;Log File Name ---> testlog.&sysdate.log
#Attempt3. Replacing first dot with Hyphen (testlog- ) to check if the first dot was causing the issue
set echo on
set feedback on
set define off
set pages 999
column dcol new_value SYSDATE noprint
select to_char(sysdate,'YYYYMMDD') dcol from dual;
spool testlog-&sysdate.log
select 'hello' from dual;
spool off;Log Filename: testlog-&sysdate.log
#Attempt4: replacing SYSDATE with SDATE
set echo on
set feedback on
set define off
set pages 999
column dcol new_value SDATE noprint
select to_char(sysdate,'YYYYMMDD') dcol from dual;
spool testlog1.&SDATE..log
select 'hello' from dual;
spool off;Log File Name -- > testlog1.&SDATE..log -
How can I copy text from PDF and include the source filename in the pasted selection?
I'm a biologist and frequently cut-and-paste notes from PDFs of scientific articles. I name all of the PDF articles with their PubMed ID, a short unique identifier (e.g. 19397482.pdf). When I take notes, I will select a few sentences from the PDF and then paste them into a text editor for later reference.
Can anyone suggest a method or script that would allow me to paste the copied text with the Pubmed filename included in a single action? I would want the pasted output it to look something like this, with the filename appended to the end:
Of the transcripts that were significantly different, there was a greater number of transcripts that were down-regulated in the IVC embryos (380) than the number of transcripts that were up-regulated (208). [20668257.pdf]
This would really help me to properly cite information sources during the writing process. I know there are bibliography managers that might be able to do something like this, but I prefer to read the PDF articles directly in Preview and select the text as I am reading.
Thanks very much for any suggestions / ideas.
jjwTo copy and paste in a single action:
tell application "Preview" to activate
tell application "System Events" to tell process "Preview"
-- Get the PubMed ID:
get the title of the front window
set thePubMedID to word 1 of result
-- Copy the selected text to the clipboard:
keystroke "c" using {command down} -- ⌘C
delay 0.25 -- adjust if necessary
-- Add the PubMed ID to the contents of the clipboard:
set theNotes to the clipboard
set the clipboard to (theNotes & space & "[" & thePubMedID & ".pdf]")
end tell
tell application "Notational Velocity" to activate
tell application "System Events"
-- Paste the contents of the clipboard to the end of the Notational Velocity document
key code 125 using command down -- ⌘↓
keystroke return & return
keystroke "v" using {command down} -- ⌘V
end tell -
Passing a FILENAME from a LINUX SHELL Script to an SQLPLUS Script
I written a LINUX Shell Script to receive a FILENAME. This FILENAME is the name of the file that I want to SPOOL into.
So, below are two items.
The first item is the LINUX Shell Script that has the FILENAME
The last item is the SQLPLUS Script that is suppose to receive the name
The LINUX Shell Script:
#! /bin/sh
LOGFILE="$(date +"%Y-%m-%d %H:%M") Oracle REPORT LOG.TXT"
FILENAME="$(date +"%Y-%m-%d") PROD Unfinished Spot Bids.CSV"
echo "File Name for the spool is:" "$FILENAME"
#spool "$FILENAME"
#sqlplus /nolog @run_test_query.sql
#sqlplus -S @Unfinished_Spot_Bids_Run_V1.sql >$LOGFILE
sqlplus -S /nolog <<EOF >$LOGFILE
/* I want to pass to the SQL file below */
/* The value that is contained in the the variable $FILENAME */
/* How do you do that? */
@@Unfinished_Spot_Bids_V1.sql
spool
set echo on
EOF
RV=$?
#if {$RV -ne 0}
#exit $RV
#else
echo "The return code fronm the sqlplus was:" "$RV"
#fi
Here is the SQLPLUS Script
CONNECT glog_read/parker@OTMPROD
set linesize 32000 trimspool on pagesize 3000
set echo off
SET TERMOUT OFF
set heading off
/* I want to parameterize the name of the file below */
/* This file is executed from inside a LINUX Shell Script */
/* That LINUX SHELL script is passed a file name */
/* I want that filename used in the "SPOOL" statement below */
/* So, how do I do that? */
spool PROD_Unfinished.CSV
prompt Shipment Update Date|Shipment Number|No of Shipments|Auctions per Shipment|No. of Carriers Notified|No of Bidders|Duration of Auction|Elapse time for first bid|Elapse time for last bid|Elapse time of bidding|Lead Time of Auction to P/U|High Bid- Low Bid Diff|
set feedback off
SELECT
to_char(c.update_date, 'FMMonth, YYYY')||'|'|| b.SHIPMENT_GID
||'|'|| count (distinct (b.SHIPMENT_GID))
||'|'|| count(distinct(a.i_transaction_no))
||'|'|| count(*)
||'|'|| sum (case when a.responding_gl_user_gid is null then 0 else 1 end)
||'|'|| min (numtodsinterval((b.expected_response - b.insert_date),'day'))
||'|'|| min (numtodsinterval((a.update_date - a.transaction_time),'day'))
||'|'|| max (numtodsinterval((a.update_date - a.transaction_time),'day'))
||'|'|| numtodsinterval((max(a.update_date) - min(a.update_date)),'day')
||'|'|| numtodsinterval((max(b.shipment_time) - max(c.insert_date)),'day')
||'|'|| (max(a.bid_amount) - min(a.bid_amount))
from tender_collab_servprov a, tender_collaboration b, shipment c
where a.i_transaction_no = b.i_transaction_no
and b.shipment_gid not in (select sqa.shipment_gid from tender_collaboration sqa, tender_collab_servprov sqb where sqa.i_transaction_no = sqb.i_transaction_no and sqb.acceptance_code = 'A')
and a.i_transaction_no in (select i_transaction_no from tender_collaboration where tender_type = 'Spot Bid')
and b.shipment_gid = c.shipment_gid
AND c.update_date >= trunc(last_day(to_date((to_char(add_months(SYSDATE,-2), 'MM-DD-YYYY')),'MM-DD-YYYY')) + 1)
group by c.update_date, b.SHIPMENT_GID
order by c.update_date, b.shipment_GID;
spool offParadicePGMR wrote:
First, I was getting an error on the SPOOL ${FILENAME}. Also, my file did have spaces and I did replace it with "_". It still did not work on the SPOOL Command. So, with or without the _, I never got the SPOOL command to work!
It seems that the FILENAME value from the LINUX script was not being passed into the SQLPLUS procedure.
How do you pass LINUX variables into the SQLPLUS procedure>
Not sure if I had the right usage => ${FILENAME}above is correct syntax -
Output of spool command?
Where will the output of the "spool filename.out" command go if I do not supply a full path name? If I'm executing my PL/SQL script in iSQL, it goes into the directory I was in when I started up iSQL. When I'm using SQL Developer, it never shows up anywhere I've looked. I see the output in "script output" window below the editor, but I can't find "filename.out" anywhere.
It should go in the default script path if you have not specified where it should go. check prefs > Database > Worksheet for details
-
I want to just spool output of a query only
now when i try to use spool command, query, output and spool off command also get spooled into the specified filename.
for ex:
SQL>spool <filename>.txt
SQL>select * from dual;
SQL>spool off
but the content of output file is:
select * from dual;
DUMMY
X
spool off;
i just want output of the query, nothing else, i.e.,
DUMMY
X
plz, suggest me soln.Save this script in a text file
Call the script...
O/P will be stored in xx.txt
script
set feedback off
set echo off
spool xx.txt
select * from dual;
spool off
set echo on
set feedback on
(You can find the same answer if search in the forum) -
Append a top line to multiple txt files
Hi there,
I have to manipulate txt files in powershell and I may not be very good at it... so any help is welcome ^^
I've got multiple files in a single folder. They are exports from a DB and are formatted like that :
"name1"
"name2"
"name3"
I need them to be :
=1
name1
name2
name3
In short I have to remove all the quotes and add "=1" on the first line of each file.
Here's what I've got so far :
$fileEntries = [IO.Directory]::GetFiles("C:\temp");
foreach($fileName in $fileEntries)
(Get-Content $fileName) |
Foreach-Object {$_ -replace '"', "" } |
Set-Content $fileName
foreach($fileName in $fileEntries)
Write-Output "=1`n" | Out-File $fileName -Append
It appends at the last line, I just can't get the "=1" at the top... any help would be much appreciated !
Thanks !Hi,
This will do what you're after:
Get-ChildItem C:\Temp -File | ForEach {
$stripped = (Get-Content $_.FullName).Replace('"','')
Write-Output '=1' | Out-File $_.FullName
$stripped | Out-File $_.FullName -Append
Don't retire TechNet! -
(Don't give up yet - 12,830+ strong and growing) -
how do I pull a sequence number from the database and use it in a sqlplus spool filename...
this is running as: sqlplus user/pass@sid@c:\file.sql
example of the file:
BEGIN
declare
V_E_NUMBER varchar2(7);
begin
SeLECT 'E'||lpad(RWP.E_NUMBER_seq.NEXTVAL,6,'0') INTO V_E_NUMBER FROM DUAL ;
end;
end;
SeLECT 'E'||lpad(RWP.E_NUMBER_seq.CURRVAL,6,'0') INTO V_E_NUMBER FROM DUAL ;
set echo off
SET HEADING OFF
SET LINESIZE 430
set verify off
SET PAGESIZE 0
SET TRIMSPOOL ON
SET timing OFF
SET termout ON
SET feedback OFF
spool d:\securedASP\CORE.BU34500.AR.'||:V_E_NUMBER||'.RECEIVD
select * from table;
spool offHi,
Use a substitution variable for that:
COLUMN v_e_number NEW_VALUE v_e
SELECT 'E' || lpad ( RWP.E_NUMBER_seq.NEXTVAL
, 6
, '0'
) AS V_E_NUMBER
FROM DUAL;
SPOOL d:\securedASP\CORE.BU34500.AR.&v_e..RECEIVD Note that this does not use PL/SQL at all.
The variable can be used without quoting or concatenation.
That may lead to situations where it's ambiguous regarding what is part of the variable name (the variable is named v_e in this example), and what is literal text that happens to come right after it. To resolve such questions, use a period to mark the end of the variable name.
In your case, you want a literal period right after the variable name, so use two: the first one marks the end of the name, and the second one is taken literally.
Look up the SQL*Plus commands
COLUMN,
SET CONCAT, and
SET DEFINE
for details. -
How to spool with varible?
I need to spool query with the variable filename.
Concept like below ::
select HOST_NAME||'_'||INSTANCE_NAME||'_'||to_char(sysdate,'YYYYMMDD_HH24MISS')||'.txt' as Filename from V$INSTANCE;
SPOOL c:\&Filename;When i run this script it will prompt for input "Filename"
any suggest please.
Regards,
SuradechSBH wrote:
Do like this
SQL> column spool new_value filename
SQL>
SQL> select HOST_NAME||'_'||INSTANCE_NAME||'_'||to_char(sysdate,'YYYYMMDD_HH24MISS')||'.txt' as File
name from V$INSTANCE;
FILENAME
IN-L-NLAA010009_abbprod_20100726_150322.txt
SQL> spool &filename
SQL> select sysdate from dual
2 /
SYSDATE
26-JUL-10
SQL> spool off
Oh, I forgot to set new_value.
Thank you so much.
Maybe you are looking for
-
Using configurator with previously free apps
I am new to apple configurator. I work in an elementary school setting and just recently purchased a mac book to help manage the growing number of school ipads. There are several apps that were downloaded while they were free but now for new purchase
-
Problem in filtering the detailed report
Hello All, I am having scenario where i need to jump from xcelsius to BW web report for details and i want this web report to be filtered by plant value .I have created the flash variable i have referenced the input value to the palnt cell in d
-
Saving BO reports in excel-time issue
Hi, I am facing an issue when i try to save a BO6.5 report in the excel format.when Busines objects saves reports into excel the issue is that the time value in Business Objects varies completley and is incorrect.There is a time difference of 11 hour
-
Filenames shortened from host dir command
forms 6 - client server - If I do the following in DOS: C:\Develop\test>dir Volume in drive C has no label. Volume Serial Number is A487-950B Directory of C:\Develop\test 14/12/2006 13:18 <DIR> . 14/12/2006 13:18 <DIR> .. 14
-
Creative Cloud lists uninstalled programs as installed?
I recently upgraded the operating system on my computer from 32 to 64-bit, and this meant I had to re-install all of my software. When I re-downloaded the creative cloud suite, it showed some of the programs as installed, even though I hadn't started