Client Tools :: Dynamically Spool Data In PL/SQL Block?

Nov 22, 2012

I have a master table A that has 10+ columns along with data and a configuration table B that has only 2 columns i.e table name and column name. For ex:-

Table A:-

C1 C2 C3 C4 C5 C6
-- -- -- -- -- -----
1 2 3 4 3 6
4 5 6 5 5 5

Table B:-

Table_Name Column_Name
--------- ----------
A C1
A C2
A C3

Now I need to write a sql script that should take the table A Columns defined in Table B and then based on the columns it should spool the columns output from Table A.

For above ex:- I need to spool the C1,C2,C3 columns data from Table A in to some Unix path using SQL SCRIPT.

View 2 Replies


ADVERTISEMENT

Client Tools :: Creating Spool File Dynamically

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

Client Tools :: How To Spool Clob Data Into Flat File

Oct 11, 2011

I want to spool CLOB data into flat file ?

View 6 Replies View Related

Client Tools :: Use Spool Command To Export Data For Other Purposes Within Application

Feb 1, 2012

I would like to use the Spool command to export data for other purposes within the application. We would like to use tab delimiter to seperate the fields but the client wants to know if the text datatype fields can be wrapped in double quotes along with the tab delimiter..

SQL>create table test (id number(2), first_name varchar2(15), last_name varchar2(15),var_no number(4),
type varchar2(1),type_no number(12));

Table created.

SQL> insert into test values(1,'mary','ross',132,'S',12);

1 row created.

SQL> insert into test values(3,'Sue','Bill',432,'S',12);

1 row created.

I tried the below spool command to use tab delimited for all the fields but not sure how to wrap double quotes for only the text fields and also would to have the column names in the 1st row but don't seem to get the full column name in the csv file.

set echo off
set feedback off
set linesize 1000
set pagesize 4000
set trim on
set headsep off
set colsep '' (used tab between the quote)

spool test.csv
select id,first_name,last_name,var_no,type,type_no from test;
spool off

View 10 Replies View Related

Client Tools :: Spool Only Time And Stats?

May 9, 2010

m spooling the results of some performance tests to a text file, the test script im using calls various sql statements in other scripts and spools to the results, stats and time to the same file...Howver I dont want to spool all the results... i only want the stats and time.. how can i do this?

my script looks like:
=====================================================
SET TERMOUT OFF
SET AUTOTRACE ON STAT
SPOOL f:/testresults.txt

[code]...

View 39 Replies View Related

Client Tools :: Spool Output And Rollback

Oct 26, 2011

I need to do the following via the sql plus command prompt :

1. Execute a large ".pls" script file which does various inserts and updates to a table.
2. Spool the output of "select * from updatedtable;" to a text file to see the changes made.
3. Rollback all the updates and inserts in the script.

View 2 Replies View Related

Client Tools :: Create Sub Folder Using SPOOL

Mar 5, 2010

I want to ask if we could create a sub folder using the SPOOL command. I tried the following but it gave "Cannot create Spool file" error.

SPOOL C:TESTABCABC.sql

where TEST is already present in the C drive whereas I want SPOOL command to create a sub-directory named 'ABC' and then create the spool file 'ABC.sql' isnside it.

Is this possible ? My OS version is MS XP.

View 4 Replies View Related

Client Tools :: Add Application Name In A Spool File?

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

Client Tools :: Spool In UTF8 Not Always Works

Oct 25, 2011

I have a problem spooling flat files in utf 8. I have 3 different sql that needs to be spooled regulary in utf8 format.the first two containing special chars is spooled without any problem, but the third that is containg only numbers and pipe-s is spooled in ansi format.

i have set nls_lang=.utf8 in my shell script, but that only worked at the first two sql the last doesnt work.

I have also tried to convert file using iconv command, but the output is still in ansi (only works if i put a special char in the ansi file then it converts to utf8 without problem) if i open the file in notepad and save as utf8 then it works, but i cannnot reach the same from unix script.

View 4 Replies View Related

Client Tools :: Spool Output In PDF Format?

Jan 3, 2011

I am looking forward for getting the output of audit records in a non-editable format as in pdf or something of that sort. Is it possible from Oracle 10g Rel-2?Can i spool output as PDF format?

View 6 Replies View Related

Client Tools :: Spool Without SQL Statement And Commands In PLSQL?

Jan 3, 2011

I have a PLSQL script.

sqlplus
$DB_ACCT << EOSQL
set heading off
set termout off
set pagesize 0

[code]....

My output in FILE.txt looks like this
SQL>
SQL> Select col_with_a||col_with_b||col_with_c from
2 alphabet_table;
abc

[code]....

I tried several options by putting set echo off, etc.What do I include in the sql script to get the output as :
abc
abc
abc

without the SQL prompt and the statement, and the spool off command?

View 2 Replies View Related

Client Tools :: Format Output File By Command Spool?

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

Client Tools :: Spool Out Hangs After Successful Execution - How To Avoid It

Oct 17, 2011

My SQLPULS script below generates 2 million records and it works fine without any errors, which I run from my batch file. (sqlplus -S %CONNECT% @"SCRIPTSmysql.sql"

The script itself runs 2 hours and exits via sqlplus.exe properly without any errors based on errorlevel from my batch and proper generated data. However, I have noticed that spool output file stops generating any records after 1 hour. It appears that client sqlplus.exe is sleeping or verifying something after spooling completed exactly the same period of time that takes to generate my out file. Is there a way to configure my script to avoid this 1 hour sleep/verification process?

whenever sqlerror exit sql.sqlcode

alter session set current_schema=blah;
/
set linesize 1000
set feedback off

[Code]....

View 3 Replies View Related

Client Tools :: Spool Clob Column To A Flag File

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

Client Tools :: How To Get SQL Query Output Into Text File Without Spool Statement

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

Client Tools :: Suppress Oracle Script Message Dynamically?

Jan 30, 2012

I wiuld like to suppress oracle messages conditionally. I am running oracle view creation scripts from command line, After successful view creation, it is showing me "view created" message. To suppress this, I have created following

set serveroutput on format wrapped;
SET TERMOUT OFF
@@test1.sql
SET TERMOUT ON

[Code]....

but still it is giving me "PL/SQL procedure successfully created" message along with "'View test831 created successfully". I need to suppress "PL/SQL procedure successfully created".

View 7 Replies View Related

Client Tools :: Not Extracting All Of The Data

Jan 30, 2013

I exported and imported data from one oracle database to another, but not all the data got loaded in to the destination database. Basically it is filtering the data. Can it be because of the reason that the sql developer may be an express edition?

View 4 Replies View Related

Client Tools :: Data Export To Excel

Aug 5, 2013

I have a specific requirement. Currently in our system a SQL script is automated trough TOAD DATA ANALYST (Contains 50 sql Select statement) and all the output are stored in a single excel file in multiple worksheet. All these sql statements are running sequentially. Now my requirement is

1) All the sql queries will be executed in database in parallel .
2) All the output of select statement will be stored in a single excel.
3) Idea using any Client but Toad is preferred.

View 1 Replies View Related

Client Tools :: Different Type Of Data Export

Feb 24, 2010

I need a free/open source tool for exporting different kind of data sets to oracle.

View 5 Replies View Related

Client Tools :: How To Transfer Data From Sql To Oracle

Jan 18, 2011

want to transfer data from sql to oracle having same structure in both database.

View 3 Replies View Related

Client Tools :: How To Remove Spaces After Data

Aug 14, 2012

I have a little problem, using SQLPLUS I use "set linesize 300", so in the END of output file file. I got spaces after info ! I mean

select client_id || ';' || date || ';' || amount info
from table

1;FEB-2012;5000........
2;DIC-2011;10000.......
500;MAR-2012;300000.... (. = spaces)

How I remove spaces after Data ?

View 5 Replies View Related

Client Tools :: Export Data In Nested Table

Feb 17, 2010

I have some problem when i try to export data from a table which contains a nested table, using toad.

When toad generate the file, in the column corresponding to the nested table, toad just write a (DATASET) instead of the data contained in the nested table

Here is an example:
INSERT INTO SSD_REV_S ( REV_ID, REV_TAB, REV_TS, REV_USER, REV_LOG )
VALUES (
TO_Date( '07/30/2007 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'), (DATASET), TO_TIMESTAMP('4/3/2009 11:20:51.000000 AM','fmMMfm/fmDDfm/YYYY fmHH12fm:MI:SS.FF AM'), 'operator', 'Add EVENT');

REV_TAB is my nested table

way to export data from a table which contain a nested table, as a list of insert statement, so i can move the data to a different database schema? I can also use different client tool.

View 3 Replies View Related

Client Tools :: Inserting Data With Substitution Variable?

May 24, 2012

I want to insert the value with '&'. But this is treated as substitution variable by oracle.So how can it is possible to do like this

INSERT INTO DEPT (DEPTNO, LOC, DNAME)
VALUES (50, '&NEW YORK', 'SALES');

View 3 Replies View Related

Client Tools :: How To Insert Data From SQL To Oracle Server

Dec 13, 2012

I have problem: I have 1 sql server already setup SQL Server 2012 Express and 1 Oracle Database server 10g. Now i want to insert data from SQL server to Oracle database through link server.

Some step i already make:
1. Setup oracle database 10g and configure listener (Finished)
2. Setup Sql server 2012 express on Windows 7 (Finished)
3. Setup ODTwithODAC1020221 on PC already setup SQL server (Finished)
4. Make Linkserver from SQL server to Oracle database (Finished), and can select data from Oracle Database on SQL server through Linkserver.

However when i insert data from SQl server to Oracle Server not success.

select * from OPENQUERY (QVHKTEST, 'SELECT * FROM QVSYSTEM')

After i run above script, result is OK
With: "QVHKTEST" is alias of Link server from SQL to Oracle server
: "QVSYSTEM" is a table on Oracle database, that table we want to get through Linkserver on SQL server

Both Server Database contain same name table is "QVSYSTEM"
-----------
INSERT OPENQUERY (QVHKTEST, 'SELECT BODY_NO,
MERCHANDISE,
MODEL_NAME,
LINE_NAME,
DATE_ENTRY
FROM QVSYSTEM')
values('VNF4619829','3227B002CA','L1068','01','2012/09/26 03:18:11');

If i run script above directly in SQL Window query can insert OK. This is code in trigger at table on SQL server:

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:<Author Name: Phuong Do Minh >
-- Create date: <Create Date: 10/12/2012>
-- Description:<Description: After data insert into table qvsystem on SQL server
-- This trigger will fire and insert that data into table qvsystem
[code].......

But when i make trigger after insert on table in SQL Server to insert data From SQL server to Oracle server, however not success and SQL server raise error below:

OLE DB provider "OraOLEDB.Oracle" for linked server "QVHKTEST" returned message "New transaction cannot enlist in the specified transaction coordinator. ".
Msg 7391, Level 16, State 2, Procedure Insert_data, Line 16

The operation could not be performed because OLE DB provider "OraOLEDB.Oracle" for linked server "QVHKTEST" was unable to begin a distributed transaction.

I don't know how to configure them.

View 8 Replies View Related

Client Tools :: DBMS-PROFILER Not Showing Any Data?

Nov 29, 2010

I am using Oracle 10G with Toad & want to use DBMS_PROFILER to identify which part of procedure is taking long time.

I created PLSQL_PROFILER_RUNS,PLSQL_PROFILER_UNITS,PLSQL_PROFILER_DATA tables. and I am running DBMS_PROFILER as below.

DECLARE
x INTEGER;
BEGIN
x := DBMS_PROFILER.start_profiler ('Test Profiler');

[code]...

The procedure run is successfully completed.I gave the following command to see the data,

SELECT runid, run_date, run_total_time, run_comment
FROM plsql_profiler_runs;
SELECT runid, unit_number, unit_type, unit_owner, unit_name, unit_timestamp,
total_time
FROM plsql_profiler_units
SELECT runid, unit_number, line#, total_occur, total_time, min_time, max_time
FROM plsql_profiler_data

No data is displayed. Then I created these tables in SYS and gave grant to public.Yet It's same. No data is coming into the tables.

View 5 Replies View Related

Client Tools :: SQL Developer Data Wizard - Row Terminator?

Sep 25, 2011

I'm new to SQL Developer and am using the wizard to import a dataset with a non-standard row terminator.The row terminator is essentially 2 spaces back to back.

In SQL Server I specified the following in the SQL Server wizard and it worked:

{CR}{LF}{CR}{LF}

What's the equivalent for oracle?

View 2 Replies View Related

Client Tools :: Return Data From Oracle For Crystal?

Aug 9, 2010

I have problems in Oracle returning data from a stored procedure. In MS SQL it's quite simple.

i.e.

CREATE OR REPLACE PACKAGE globalpkg
AS
TYPE RCT1 IS REF CURSOR;
TRANCOUNT INTEGER := 0;
IDENTITY INTEGER;
END;
/

next the stored procedure:

CREATE OR REPLACE PROCEDURE mytest
(
RCT1 OUTGLOBALPKG.RCT1
)
AS
BEGIN
OPEN RCT1 FOR
SELECT *
FROM EMPLOYEE;
END;

Next trying to run the Stored procedure:

VARIABLE resultSet REFCURSOR
EXEC mytest (:resultSet);

Result always returns this error:

REFCURSOR - Unrecognized type.

I have tried using sample on the internet, but all returns the same error, what am I missing

View 32 Replies View Related

Client Tools :: Sql Developer Online Data Move

Dec 1, 2011

I am using SQL developer 2.1 to migrate tables from Sybase 12 database to oracle 11g. I have used online data move option for moving sybase data into oracle tables, but even after data move is completed not all rows have been moved from sybase tables to corresponding oracle tables. Some rows are missing but still there is no error message being displayed, how to find out what's going wrong.

View 3 Replies View Related

Server Utilities :: Which Client Need To Use Data Pump Tools

Feb 13, 2012

I'm installing a new application-testing server, i have installed 11g r2 instant clients & SQL* Plus client.

when i'm trying to run an expdp command, i get this:

'expdp' is not recognized as an internal or external command

Now, i understand this is because i don't have the Bin directory of a client installation in my Path of the OS. My question is, which one exactly i need for using data-pump utility, and where to download it?

I've found lots of posts of people that had issues with defining the ORA_HOME$in in the $PATH, or having a client incompatibility issue throughout the web, but no answer to my specific question.

View 4 Replies View Related

Client Tools :: Creating Sequence Value After Data Import?

Feb 23, 2011

I have an excel sheet as follows: I have to import the data in the excel sheet to oracle database table through TOAD.

name1 name2 name3
ABS SDFG FHTR
DFR GHJK HJK
... ... ...

Now, I need an id column along with these three that would have id numbers like that of a sequence. That means, suppose I have 1000 records in the excel sheet, then the table should have as many numbers automatically after data import.

View 18 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved