Client Tools :: Running Query Using CSV File As Reference
Feb 19, 2012
I need to say I am an absolute NOOB when it comes to SQL.I need a script to run in TOAD that will reference a CSV file saved onto my local hard drive. I'll try and describe exactly what I need to do.
The current script which I use via TOAD on our companies READ ONLY database is this:
SELECT d.number_id,
d.status_id,
FROM table.number_t d
WHERE d.number_id IN ('1230001', '1230002', '1230003')
This will return a result for each number that exists within the table.number table along with the status of each number i.e. active or inactive. A very basic query.
What I need to be able to do is run that query but instead of having to copy each number into TOAD manually, I need TOAD to check a .csv file of said numbers and then return the results.So I imagine the query would look something like:
SELECT d.number_id,
d.status_id,
FROM table.number_t d
WHERE d.number_id IN (check
View 13 Replies
ADVERTISEMENT
May 17, 2012
I want to execute a query which automatically saves the result of a set of queries in a text file and have to send that as an attachment thru a mail (using UTL_MAIL or UTL_SMTP) thru a stored procedure...saving the result in a text file in Toad.
View 2 Replies
View Related
Dec 12, 2012
I'm running this query on sql developer trying to export large file but its not executing.
set head off
spool c:myoracle.txt
select txt_name_insurer||'~'||txt_policy_number from Table_Name where rownum<'10';
spool off
set head on
Error:- line 1: SQLPLUS Command Skipped: set head on
View 16 Replies
View Related
Mar 7, 2011
I would like to store my sql query output into text file.Like for example:
select name from emp where emp_id=101;
Here output should be in text file as
swapna.
I dont want to use spool statement here,since If I use it,spool statement will also be printed in text file which is not my requirement.I just want to take only output.
View 1 Replies
View Related
Oct 20, 2010
I need to run Toad codexpert using command line I am trying the following command
"C:Program Files... oad.exe" CX="C:... CmdLineTest.ini"
When I execte the command from command line .Codeexprt run and stop after some time and it make entry in the error log as "ora-00942 table or view does not exist".
View 1 Replies
View Related
Jun 4, 2012
I run procedure on toad 10.5, it gave me this error
Buffer overflow, limit of 20000 bytes
then it can not continue running the procedure.
View 8 Replies
View Related
Jul 23, 2012
Is there any setups required for creating a utl file using sql developer. If yes, what are the setups to be done.
View 1 Replies
View Related
Oct 10, 2011
I am connected to an oracle database on campus thru my laptop. The interface i am using is oracle sql developer. We are practicing entering SQL commands. The connection name is DBA120. So, the name of the database is DBA120, correct? Also, I must review the respective ERD (i.e., to know the table relationships) in order to determine the proper sql commands, correct?
Well, in this database connection (DBA120), there are several tables that actually pertain to three different databases, ACCOUNTING, BOOK, and DJ. (I have the respective ERDs.)
I want to be able to save a database to file so I can run it on another computer. How do I save each of the three databases to a file or can't I? Or must I save the DBA120 database? how do i do that? do i save it(them) as sql files?
View 2 Replies
View Related
Jul 26, 2011
To add application name in a spool file, I am using the below way.
sqlplus username/pwd@tns @xyz.sql APP0115
SQL> define appname="'&1'"
Enter value for 1: APP0115
SQL> prompt &appname
'APP0115'
SQL> spool &appname._html_jobs.csv;
SP2-0768: Illegal SPOOL command
Usage: SPOOL { <file> | OFF | OUT }
where <file> is file_name[.ext] [CRE[ATE]|REP[LACE]|APP[END]]
But I am getting the above error in the spool file clause because of single quote printing infront of the spool file. But the method of defining a character is "'&1'". So I cannot avoid this single quote in the define clause.
'APP0115'
print the appname like APP0115 instead 'APP0115'.then only I can use this in the spool file clause?
View 3 Replies
View Related
Apr 2, 2012
I need generate a script like this.
spool loadvalues.sql
INSERT INTO SALES(column1, column2, column2) SELECT( COLUMN1, COLUMN2, COLUMN3) FROM TABLE_NAME;
spool off;
I would like to substitute TABLE_NAME with each value from the following query;
select table_name from user_tables
where table_name like 'SALES%'
so there are about 45 SALES tables ex: SALES_IDAHO,SALES_MICHIGAN etc.so my spool file(loadvalues.sql) should look like this ex:
INSERT INTO SALES(column1, column2, column2) SELECT( COLUMN1, COLUMN2, COLUMN3) FROM SALES_IDAHO;
sales_michingan should have script like
INSERT INTO SALES(column1, column2, column2) SELECT( COLUMN1, COLUMN2, COLUMN3) FROM SALES_MICHIGAN;
View 2 Replies
View Related
May 30, 2011
how to get rid of the first EMPTY line generated by SQL*Plus when spool'ing to a file.
I tried using set pagesize 0 and while that get rid of the empty blank line, it also disabled the heading ...
Currently using sed as a work around. But unfortunately, can't use sed on Windows?
set pagesize 200
set heading on
set trimspool on
set lines 200
set verify off
set echo off
set feedback off
[code].......
As mentioned, using pagesize 0 remove the blank line but I also lost the heading.
View 4 Replies
View Related
Nov 27, 2012
Is it possible to execute multiple sql files in one .bat file?for single sql file it is working properly.
.bat file
-------------------------------
sqlplus /nolog @ c: est01.sql
View 5 Replies
View Related
Feb 2, 2010
i m unable to run the following script in sqlplus
SQL> @D:vasucount.sql
SP2-0310: unable to open file "D:vasucount.sql"
SQL>
View 5 Replies
View Related
Mar 15, 2011
Is it possible to trim the file name while loading into OWB through external tables?
Like suppose I am trying to read a file which has a timestamp value appended in its name. In that case loading into external file would give an error.
View 3 Replies
View Related
Oct 23, 2012
From within a DOS batch file I make the following call:
sqlplus [User]/[password]@[server] @batch_script.sql [Server] [User]
Within the file batch_script.sql I have the following lines:
spool output_batch.lst
connect &&2/[password]@&&1;
@SomeOtherFile.sql
I want to change the last line to something like this:
if &&1 = 'Something' then
@SomeOtherFile1.sql
else
@SomeOtherFile2.sql
end if;
I get the following result
SQL> if &&1 = "something" then
SP2-0734: unknown command beginning "if &&1 = "..." - rest of line ignored.
I took a shot at using the "If" statement and missed.
View 12 Replies
View Related
Aug 20, 2010
how to create a file in a folder based on todays date. i need to know how to define a variable in sqlplus and assign a value to it.Here is the code below. The code gets executed without creating a spool file.
DEFINE _DATE = replace('C:\_sysdate_EU001.csv', '_sysdate_', TO_CHAR(SYSDATE, 'DD-MON-YYYY'))
spool _DATE
set serveroutput on size 100000
select * from dual;
spool off
View 14 Replies
View Related
Jun 5, 2013
I heard .MDD file is Database Designer for MYSQL(i don't knw exactly).how to create it..
View 1 Replies
View Related
Oct 24, 2012
Here is the query I want to be able to run...
select * from NonExistingTableName
I want the query above to be ignored and return no results (rather than generating an error) when the tablename does not exist.
View 14 Replies
View Related
Jan 24, 2011
is it possible to write select query o/p in html tag?
View 6 Replies
View Related
Oct 9, 2012
I am trying to pass the parameters to query and I need to pass few parameters to query. Can I make it like like then I run it, then it come up and ask the parameter like this:
SQL> @text
para1 XXXXX
para2 XXXXX
And then the result of query will come up. I would like to put label for each parameter( likepara1).
View 11 Replies
View Related
May 31, 2012
is it possible to write sql query o/p in HTML page?
View 3 Replies
View Related
Feb 3, 2011
i do have a set of monthly process, where i need to run query one after the other. Some query will take one hours time to complete but some will take 10 hours or more to execute. My problem is that we have wait or machine shouldn't hang or log off during that time ...
I am executing the query in TOAD and windows SQL*Plus. Query can run Parallel at a time.
Is the there anyway to run the query in the background like what we do in the unix nohup command in toad?
View 11 Replies
View Related
Jan 20, 2011
I use sqplus in oracle to output the command output to text file .
I use below set environment varialble.
SQL> set echo off;
SQL> set linesize 3999;
SQL> set feedback off;
SQL> set feedback off;
SQL> set termout off;
SQL> set pagesize 0;
SQL> spool mapping.txt
select C_SIM_MSISDN,C_SIM_IMSI from RCA_SMART_CARD order by C_SIM_MSISDN;
In ouput file , it look like
SQL> select C_SIM_MSISDN,C_SIM_IMSI from RCA_SMART_CARD order by C_SIM_MSISDN;
060010007 10007
:
:
:
SQL> spool off;
any setting or command that allow me to remove the first sql command line" SQL>select XXXX" and the last command "SQL>spool off" after start up the "spool mapping.txt"
View 8 Replies
View Related
May 28, 2012
We have a table partymast. we want to import the data into this table using excel file having extension .csv. I am explaining all the things below:
select *from partymast
partyid partyname accountname aacname
aa aa 10014000023367 Ashish
select * from master
masterid mname
10014000023367 Ashish
aacname column in partymast table is fetching from master table mname column.
We have third table name IMPEXP
Iename iedesc ietype iedef
import party master import party master imp {ImportStart}
[Transid]=party
[ImportFile]=:
[FileType]=excel
PartyID=col_1
PartyCat=col_2
AccountName=col_3
{ImportEnd}
Sir, I am enclosing the Excel file. what will be the next step that we should filllow.
View 3 Replies
View Related
Jul 15, 2013
I would like to spool a clob column to a flag file, however some of the clob are greater than 32k, and I have to have the same record in a single line in the file. Is there any way to achieve this through spooling?
set heading off
set feedback off
set term off
set long 1000000
set longchunksize 500000
set line 32767
set trimspool on
set pagesize 50000
spool file.txt
@--this is my select statement.
spool off
exit
View 1 Replies
View Related
Jul 2, 2012
i'm working on sql developer my table contains 40 columns and contains around 4 to 5 lakhs records........
when i'm trying to export the results into excel or text file my sql developer is getting hanged... if the result is less than 2lakh record its copying....
View 6 Replies
View Related
Oct 11, 2011
I want to spool CLOB data into flat file ?
View 6 Replies
View Related
Apr 14, 2012
when i run the script file 1.sqlIt throws me following error
SQL> @/c/temp/1.sql
SP2-0310: unable to open file "/c/temp/1.sql"
View 4 Replies
View Related
Jan 24, 2012
When i run the below mentioned query(similar query)on TOAD. It will run without any errors and i can see "PL/SQL Procedure successfully completed" in the task bar.....
However i am unable to see the output for the query.
print the the query output on TOAD ....
**** Sample Query Starts *****
DECLARE
i PLS_INTEGER;
BEGIN
SELECT NVL(i, 93)
INTO i
FROM DUAL;
--print i;
--dbms_output.put_line('i1: ' || i);
END;
**** Sample Query Ends*****
**** Actual Query Starts *****
-----------------------------------------------------------------
DECLARE
UnxDate number(6);
MyResult number(6);
Todaysdate date := TO_DATE('17-01-2012 00:00:00','dd-mm-yyyy hh24:mi:ss');
BEGIN
SELECT ROUND (Todaysdate - TO_DATE('01-jan-1970','dd-mon-yyyy') ) INTO UnxDate FROM dual;
[code]......
View 9 Replies
View Related
Sep 11, 2013
The date is different for same query in Toad and Sql Developer.
Below is the query
In SQL Developer
SELECT start_date, length(start_date) from my_table where p_id = 1;
09-MAY-5249 9
In Toad
SELECT start_date, length(start_date) from my_table where p_id = 1;
blank 9
Did some queries below for research.
SELECT start_date, DUMP(start_date, 1016)
from my_table
where p_id = 1;
09-MAY-5249Typ=12 Len=7: 30,37,d5,a,0,a2,d5
SELECT start_date, DUMP(start_date, 1016)
from my_table
where p_id = 2;
01-JAN-2013Typ=12 Len=7: 78,71,1,1,1,1,1
Why is same query returning two different results in two tools.
View 16 Replies
View Related