Output Query to CSV via SQL +
I can build the csv file and put the results into the csv file but the query itself is also place in the top of the file.
My question is, How do I output the query results and NOT the query? I thought the "echo off" would have fixed that?
THis is Oracle 10.2.0.4.0 in on a windows 2003 platform.
Here is my code:
spool ON
SET PAGESIZE 500
echo off
spool C:\CL_User_Reports\TEST.csv
select USERID, Entitlement, decode(who,-1,'Active','Inactive') Status
from
select userid, 'dba' Entitlement, dba who from USERIDTBL
union all
select userid, 'bla', bla from USERIDTBL
union all
select userid, 'hxrep', hxrep from USERIDTBL
union all
select userid, 'lma', lma from USERIDTBL
union all
select userid, 'rep', rep from USERIDTBL
union all
select userid, 'psa', psa from USERIDTBL
) a
order by a.userid;
spool off;
This is what the output file looks like:
SQL> select USERID Entitlement decode(who -1 'Active' 'Inactive') Status
2 from
3 (
4 select userid 'dba' Entitlement dba who from USERIDTBL
5 union all
6 select userid 'bla' bla from USERIDTBL
7 union all
8 select userid 'hxrep' hxrep from USERIDTBL
9 union all
10 select userid 'lma' lma from USERIDTBL
11 union all
12 select userid 'rep' rep from USERIDTBL
13 union all
14 select userid 'psa' psa from USERIDTBL
15 ) a
16 order by a.userid;
The actual results are then shown here...
Edited by: 887207 on Sep 23, 2011 12:37 PM
Edited by: 887207 on Sep 23, 2011 12:39 PM
That is a sqlplus command. [url http://download.oracle.com/docs/cd/E11882_01/server.112/e16508/cncptdba.htm#CNCPT831]sqlplus is an oracle tool to use SQL and procedural statements. In sqlplus, say show all to see the various settings. They are explained in the [url http://download.oracle.com/docs/cd/E11882_01/server.112/e16604/toc.htm]manual.
If you are new to Oracle, be sure and read the Concepts manual.
Similar Messages
-
How do i get a output in CSV of a SQL query executed via SQL Command prompt
Hi All,
I have a question with reference to SQL command prompt. I have a sql query which runs properly and gives proper execution in SQL Management console in GUI.
This report is used to pull the free disk space report of our servers
As i want to schedule it as a report so i want to script it to run via SQL command prompt. I made the script and it works fine if i enter it in SQL command prompt. When i try to extract the output to a CSV File it fails. Below is the details of the command
i am using to query to pull the data. Can anyone help me in getting the output of this query in SQL command prompt.
sqlcmd -W -s , -S Servers FQDN
use operationsmanager
Go
Query:"select Path, InstanceName, SampleValue
from PerformanceDataAllView pdv with (NOLOCK)
inner join PerformanceCounterView pcv on pdv.performancesourceinternalid = pcv.performancesourceinternalid
inner join BaseManagedEntity bme on pcv.ManagedEntityId = bme.BaseManagedEntityId
where SampleValue < '20' and CounterName='% Free Space' and TimeSampled > '2014-08-06 11:00:00.00'
order by countername, timesampled" -s "," -o "C:\DataSqlCmd.csv"
Go
When i enter the command without the quotes when the query is starting and ending and also without the output command (-s "," -o "C:\DataSqlCmd.csv") it is working and shows the output in the command prompt. Below is the screen shot for
your reference.
Due to security reasons i have to erase the server names:
But when i add the line to extract the output ( -s "," -o "C:\DataSqlCmd.csv") It gives me this error:
The exact command would be:
sqlcmd -W -s , -S CINMLVSCOM01.e2klab.ge.com
use operationsmanager
Go
"select Path, InstanceName, SampleValue
from PerformanceDataAllView pdv with (NOLOCK)
inner join PerformanceCounterView pcv on pdv.performancesourceinternalid = pcv.performancesourceinternalid
inner join BaseManagedEntity bme on pcv.ManagedEntityId = bme.BaseManagedEntityId
where SampleValue < '20' and CounterName='% Free Space' and TimeSampled > '2014-08-06 11:00:00.00'
order by countername, timesampled" -s "," -o "C:\DataSqlCmd.csv" -h-1
Go
saying the syntax is not correct or some thing as per the below screenshot.
Can any one please help. Below is just the query whi i use to get the output in SQL management studio.
Can any one make a command for the below quer so i can directly execute and test for getting the output.
select Path, InstanceName, SampleValue
from PerformanceDataAllView pdv with (NOLOCK)
inner join PerformanceCounterView pcv on pdv.performancesourceinternalid = pcv.performancesourceinternalid
inner join BaseManagedEntity bme on pcv.ManagedEntityId = bme.BaseManagedEntityId
where SampleValue < '20' and CounterName='% Free Space' and TimeSampled > '2014-08-06 11:00:00.00'
order by countername, timesampled
Gautam.75801Can you try the below query?
select Path, InstanceName, SampleValue
from PerformanceDataAllView pdv with (NOLOCK)
inner join PerformanceCounterView pcv on pdv.performancesourceinternalid = pcv.performancesourceinternalid
inner join BaseManagedEntity bme on pcv.ManagedEntityId = bme.BaseManagedEntityId
where SampleValue < 20 and CounterName like '% Free Space' and TimeSampled > '2014-08-06 11:00:00.00'
order by countername, timesampled
-- replace the below query part in the below SQLCMD C:\>SQLCMD -S SERVERNAME -E -d operationsmanager -Q "select * from sys.databases ds with (nolock) where name='master'" -s "," -o "F:\PowerSQL\MyData.csv" -h -1
SQLCMD -S SERVERNAME -E -d OperationsManager -Q "select Path, InstanceName, SampleValue
from PerformanceDataAllView pdv with (NOLOCK)
inner join PerformanceCounterView pcv on pdv.performancesourceinternalid = pcv.performancesourceinternalid
inner join BaseManagedEntity bme on pcv.ManagedEntityId = bme.BaseManagedEntityId
where SampleValue < '20' and CounterName='% Free Space' and TimeSampled > '2014-08-06 11:00:00.00'
order by countername, timesampled" -s "," -o "c:\MyData.csv" -h -1
Refer for the other ways
http://dba.stackexchange.com/questions/23566/writing-select-result-to-a-csv-file
--Prashanth -
Retrieve online file as CSV via HTTPS using PL/SQL procedure
Hi all,
Situation:
Server A (not ORACLE)_: accesed via URL, generates dynamically a CSV file and returns to the requestor.
Server B (ORACLE)_: which runs the PL/SQL script. It is the requestor. Read the CSV and store it within ORACLE.
(1) I want to connect from Server B (ORACLE) to an external URL via HTTPS which generates dynamically the CSV file. Subdomain.domain it is the Server A which contains this CSV file.
https://dubdomain.domain/csv_generator.php?query=q1
(2) This file is downloaded to the Server B (ORACLE). A PL/SQL script executed in this machine do the task.
(3) After that, I load this CSV to an ORACLE table which a common CSV PL/SQL parser.
Doubts:
Is it possible to retrieve an online file (a CSV) dynamically created and hosted in a third party server (Not ORACLE) via HTTPS using a PL/SQL procedure executed in a ORACLE server? If the answer is yes, what technology could I use? Any ideas?
Thanks in advance,
YagoAn CSV example in {message:id=10158148}.
For https, two actions are needed in addition.
Firstly, the certificate of the https web server needs to be loaded in an Oracle Wallet on your database server. The wallet will have a specific directory location on the server, and will be protected by a password.
Secondly, the PL/SQL procedure making web call, needs to open the wallet (using <i>UTL_HTTP.set_wallet</i>) using the location and password. Example of that in {message:id=10820182}. -
Hi,
I'm having trouble getting the correct serial numbers via SQL.
From PHP I run the following query to get the Delivery Notes:
select ODLN.DocEntry,ODLN.CardCode,ODLN.CardName,ODLN.DocDueDate,ODLN.DocDate,ODLN.NumAtCard,NNM1.SeriesName,ODLN.DocNum,ODLN.SlpCode,ODLN.CANCELED,ODLN.DocStatus,DLN1.ItemCode,DLN1.Dscription,DLN1.Quantity,DLN1.ShipDate,DLN1.LineStatus,ODLN.NumAtCard,ODLN.U_CodSit,ODLN.DocTotal,ODLN.DocCur,ODLN.CreateDate,ODLN.TrackNo,DLN1.SerialNum from ODLN INNER JOIN NNM1 ON (ODLN.Series = NNM1.Series) INNER JOIN OCRD ON (ODLN.CardCode = OCRD.CardCode AND OCRD.CardCode = '".$_POST["sapcode"]."' AND OCRD.Password = '".$_POST["sappwd"]."') INNER JOIN DLN1 ON ODLN.DocEntry = DLN1.DocEntry ORDER BY ODLN.CreateDate DESC,ODLN.DocEntry ASC
While I loop through the results I then try to grab the serial numbers. I tried this:
SELECT OSRI.IntrSerial FROM OSRI INNER JOIN SRI1 ON ( (SRI1.SysSerial = OSRI.SysSerial) AND (SRI1.BaseNum = ".$row['DocNum'].") ) INNER JOIN DLN1 ON (DLN1.DocEntry = SRI1.BaseEntry) WHERE ( (DLN1.DocEntry = ".$row['DocEntry'].") AND (DLN1.ItemCode = OSRI.ItemCode) AND (DLN1.ItemCode = '".$row['ItemCode']."') ) ORDER BY OSRI.IntrSerial
but it gives me incoherent results compared to what appears in the SAP b1 client. For ex., some serial numbers are fine but in other cases I get more serial numbers than accounted for (article quantity = 1 but get 2 serial numbers; in SAP B1 client only one of the two serial numbers appears, as expected).
So I then modified the query and added a check for the CardCode:
SELECT OSRI.IntrSerial FROM OSRI INNER JOIN SRI1 ON ( (SRI1.SysSerial = OSRI.SysSerial) AND (SRI1.BaseNum = ".$row['DocNum'].") AND (SRI1.CardCode = '".$_POST["sapcode"]."') ) INNER JOIN DLN1 ON (DLN1.DocEntry = SRI1.BaseEntry) WHERE ( (OSRI.CardCode = '".$_POST["sapcode"]."') AND (DLN1.DocEntry = ".$row['DocEntry'].") AND (DLN1.ItemCode = OSRI.ItemCode) AND (DLN1.ItemCode = '".$row['ItemCode']."') ) ORDER BY OSRI.IntrSerial
This query is slightly better in the sense that at least I don't get serial numbers that are not supposed to be there (eg. if quantity=1 I will not get 2 serial numbers as in the previous query). However, in some cases it works as expected and in other delivery notes it doesn't because it simply doesn't list the serial numbers (which where found in the first query).
It might be because the CardCode field isn't always thoroughly set?
If so, is it just a "user problem" so I should tell my company to review the way they fill SAP data?
Or am I doing the wrong query?
(The SDK doc regarding OSRI is confusing as it doesn't even point to SRI1 and I don't fully understand the relationships)
Regards,
VieriVieri,
you can catch (using MS SQL Profiler) the query which is executed by SBO once you click on serial nambers report from Delivery Note form.
this is one of the ways to get a solution quickly. -
Query performance : TOAD Vs SQL Plus, and caching of query output
Hi,
I have one query which takes more than 2 minutes in TOAD, but the same one takes less than 30 secs when executed in SQL Plus. Can some body please tell me why the performance is so different in the two. Is this a known issue? Can i get the actual time required for a query?
Also when I execute the same query in TOAD for the second time in succession, the execution time reduces drastically from 2 mins to 10 secs. Does caching occur in TOAD? Can I disable it. I am using TOAD for Oracle, Version 9.0.0.160.
Thanks,
Rahul.user641207 wrote:
Hi,
I have one query which takes more than 2 minutes in TOAD, but the same one takes less than 30 secs when executed in SQL Plus. Can some body please tell me why the performance is so different in the two. Is this a known issue? Can i get the actual time required for a query?
Also when I execute the same query in TOAD for the second time in succession, the execution time reduces drastically from 2 mins to 10 secs. Does caching occur in TOAD? Can I disable it. I am using TOAD for Oracle, Version 9.0.0.160.Rahul,
it's unlikely but possible that the session established via TOAD has different settings than the session established via SQL*Plus.
You can check V$SQL and V$SQL_SHARED_CURSOR to find out if the SQL you're executing has different plans, which would result in multiple rows in V$SQL for the same SQL_ID (10g) or ADDRESS, HASH_VALUE (pre-10g) with different CHILD_NUMBERs and V$SQL_SHARED_CURSOR can tell you why they can't share the plan, in case you've got multiple plans.
In addition you can use V$SES_OPTIMIZER_ENV to find out if the optimizer related settings differ for the TOAD and SQL*Plus session.
The caching effect is probably the caching of the database rather than anything else. I don't think that TOAD caches the result on the client side.
Regards,
Randolf
Oracle related stuff blog:
http://oracle-randolf.blogspot.com/
SQLTools++ for Oracle (Open source Oracle GUI for Windows):
http://www.sqltools-plusplus.org:7676/
http://sourceforge.net/projects/sqlt-pp/ -
.csv data import via SQL developer
I am trying to load an Access 2003 table into an Oracle 10g database via SQL developer. The Access file is located on another system and there is no ODBC connection between it and the SQL server.
What I have done so far is the following:
i) Export Access table as comma-delimited text file;
ii) Open text file and re-saved as .CSV;
iii) On SQL developer - created a table that matches the column structure in the original Access table, then right-clicked > Import Data > on Data Import Wizard I click Next...
after this, the wizard hangs on step 1, and does not allow me to move to the second step. It doesn't matter whether or not the SQL *Loader option is checked.
If anyone could offer some advice on the procedure I have applied above and possible sources of weakness, I'd be grateful to hear your thoughts. I'm relatively new to Oracel SQL and not very experienced with databases in general.
ThanksSince this is not native export/import, a better place could be this forum:
SQL Developer -
Generate dynamic reports using sql query and send via mail
Can anyone provide me the links to dynamically generate the sql query based reports and send it to Mail. it should be called from the scheduler program using PL/SQL
suppose you have the query as
spool myrep.txt
select * from emp where rowid<3;
spool off
write the query in the emp.sql query at any directory like d:\sqljobs\emp.sql
the call make a batch file like sndml.bat and write the following codes
sqlplus scott/tiger@orcl @d:\sqljobs\emp.sql
explorer mailto:[email protected] d"\sqljobs\myrep.txt
or if you are using any mailing software then you can use that.. -
Situation:
SSIS Package designed in SQL Server 2012 - SQL Server Data Tools
Windows 7 - 64 bit.
The package (32 bit) extracts data from a SQL Server db to an Excel Output file, via an OLE DB connection.
It uses 3 package variables:
*) SQLCommand (String) to specify the SQL Statement to be executed by the package
Property path: \Package.Variables[User::ExcelOutputFile].Properties[Value]
Value: f:\Output Data.xls
*) EXCELOutputFIle (String) to specify path and filename of the Excel output file
Property path: \Package.Variables[User::SQLCommand].Properties[Value]
Value: select * from CartOrder
*) VarObjectDataSet (Object) to hold the data returned by SQL Server)
Property path: \Package.Variables[User::VarObjectDataSet].Properties[Value]
Value: System.Object
It consists out of 2 components:
*) Execute SQL Task: executes the SQL Statement passed on via a package variable. The resultng rows are stored in the package variable VarObjectDataSet
*) Script Task: creates the physical output file and iterates VarObjectDataSet to populate the Excel file.
Outcome and issue:The package runs perfectly fine both in SQL Server Data Tools itself and in DTEXECUI.
However, whenever I run it via SQL Server Agent (with 32 bit runtime option set), it returns the errror message below.
This package contains 3 package variables but the error stating that a package variable can not be set, pops up for the VarObjectDataSet only. This makes me wonder if it is uberhaupt possible to set the value of a package variable
of type Object.
Can anybody help me on this please ?
Message
Executed as user: NT Service\SQLSERVERAGENT. Microsoft (R) SQL Server Execute Package Utility Version 11.0.2100.60 for 32-bit Copyright (C) Microsoft Corporation. All rights reserved. Started: 6:40:20 PM DTExec: Could
not set \Package.Variables[User::VarObjectDataSet].Properties[Value] value to System.Object. Started: 6:40:20 PM Finished: 6:40:21 PM Elapsed: 0.281 seconds. The package execution failed. The step failed.
Thank you very much in advance
JurgenHi Visakh,
thank you for your reply.
So, judging by your reply, not all package variables used inside a package need to be set a value for when run in DTEXEC ?
I already tried that but my package ended up in error (something to do with "... invocation ...." and that error is anything but clearly documented. Judging by the error message itself, it looks like it could be just about anything. that is why I asked my
first question about the object type package variable.
Now, I will remove it from the 'set values' list and try another go cracking the unclear error-message " ... invocation ...". Does an error message about " ... invocation ..." ring any bells, now that we are talking about it here ?
Thx in advance
Jurgen
Yes exactly
You need to set values only forthem which needs to be controlled from outside the package
Any variable which gets its value through expression set inside package or through a query inside execute sql task/script task can be ignored from DTExec
Ok I've seen the invocation error mostly inside script task. This may be because some error inside script written in script task. If it appeared after you removed the variable then it may because some reference of variable existing within script task.
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
Hi,
I am using OCCI to interact with DB through code, which means I am writing a vc++ file to interact with Data Base and execute the Stored Procedure which I am calling from the C++ Code. And also displaying the output of the Stored Procedures to the Front End. I am succeeded in this, but now I should be able to display the Column names of the output to Front End. Can any one help me on this.
Example:
Sno | Sname
------- |-------------
1 ABC
2 DEF
I am getting (1,ABC) and (2,DEF) as the output of the Stored Procedure but I need the Column names also to display. How to get them.
Thanks in Advance..:)Look at Re: exporting csv via pl/sql - select statement?
It has an example how to extract the column name from a cursor. You have to check, whether you can use DBMS_SQL.DESCRIBE_COLUMNS
Your procedure might need another out parameter, that returns the column names , e.g. as comma separated list or as varray. -
Creating XML file via sql in 10g database
Hi
I am using an Oracle 10g database and via a procedure that is called from Forms 10g, I want to output data in XML format so that this file can be fed into an accounting system that uses XML.
How do I go about doing this?How do I go about doing this?The most flexible way is via SQL/XML publishing functions.
And use DBMS_XSLPROCESSOR.CLOB2FILE to write the result to a file in a single call :
DECLARE
xmlresult clob;
BEGIN
select xmlelement("Departments",
xmlagg(
xmlelement("Department",
xmlattributes(
d.deptno as "id"
, d.dname as "name"
, xmlelement("Employees",
xmlagg(
xmlelement("Employee",
xmlattributes(e.empno as "id")
, xmlforest(
e.ename as "Name"
, e.job as "Job"
, e.mgr as "ManagerId"
) order by e.empno
) order by d.deptno
).getclobval()
into xmlresult
from scott.dept d
join scott.emp e on e.deptno = d.deptno
group by d.deptno, d.dname
dbms_xslprocessor.clob2file(xmlresult, 'TEST_DIR', 'departments.xml');
END;
/Output : departments.xml in Oracle directory TEST_DIR :
<Departments>
<Department id="10" name="ACCOUNTING">
<Employees>
<Employee id="7782">
<Name>CLARK</Name>
<Job>MANAGER</Job>
<ManagerId>7839</ManagerId>
</Employee>
<Employee id="7839">
<Name>KING</Name>
<Job>PRESIDENT</Job>
</Employee>
<Employee id="7934">
<Name>MILLER</Name>
<Job>CLERK</Job>
<ManagerId>7782</ManagerId>
</Employee>
</Employees>
</Department>
<Department id="20" name="RESEARCH">
<Employees>
<Employee id="7369">
<Name>SMITH</Name>
<Job>CLERK</Job>
<ManagerId>7902</ManagerId>
</Employee>
<Employee id="7566">
<Name>JONES</Name>
<Job>MANAGER</Job>
<ManagerId>7839</ManagerId>
</Employee>
<Employee id="7902">
<Name>FORD</Name>
<Job>ANALYST</Job>
<ManagerId>7566</ManagerId>
</Employee>
</Employees>
</Department>
<Department id="30" name="SALES">
<Employees>
<Employee id="7499">
<Name>ALLEN</Name>
<Job>SALESMAN</Job>
<ManagerId>7698</ManagerId>
</Employee>
<Employee id="7521">
<Name>WARD</Name>
<Job>SALESMAN</Job>
<ManagerId>7698</ManagerId>
</Employee>
<Employee id="7654">
<Name>MARTIN</Name>
<Job>SALESMAN</Job>
<ManagerId>7698</ManagerId>
</Employee>
<Employee id="7698">
<Name>BLAKE</Name>
<Job>MANAGER</Job>
<ManagerId>7839</ManagerId>
</Employee>
<Employee id="7844">
<Name>TURNER</Name>
<Job>SALESMAN</Job>
<ManagerId>7698</ManagerId>
</Employee>
<Employee id="7900">
<Name>JAMES</Name>
<Job>CLERK</Job>
<ManagerId>7698</ManagerId>
</Employee>
</Employees>
</Department>
</Departments>(formatted for display purpose) -
How to output query results directly to a file
Hello,
I'm new to this and i need to know how to output the results of a query directly to a file instead of it displaying on the screen and then outputting to a file in SQL Developer Version 2.1.0.63.
Thanks in advance for any help!
Edited by: user13036938 on Jun 16, 2010 7:24 AM
Edited by: user13036938 on Jun 16, 2010 7:25 AMfor a really basic spool:
SPOOL [FILEPATH];
SELECT [SOMETHING] FROM [SOMETABLE] WHERE [SOMECONDITION];
SPOOL OFF;see also:
http://www.oracle.com/technology/products/database/sql_developer/files/sql_worksheet_commands.html
for a list of other useful SQLPlus commands supported by SQL Developer
Edited by: Irian on 16-giu-2010 17.08 -
Output query result to a text file in ORACLE
I Need a procedure for generating output query into text file in Oracle.
for Example,
A table called Tab1
the columns are c1,c2,c3,c4,c5.
I want to store the data in text file in...
First row as a column name & then, appear the records in second row onwards...
c1|c2|c3|c4|c5.
Please kindly provide the solution for this ASAP.In case you are using Oracle 9i or higher you should better create a DIRECTORY rather then setting utl_file_dir,e.g.
SQL> CREATE DIRECTORY log_dir AS '/appl/gl/log';
SQL> GRANT READ ON DIRECTORY log_dir TO DBA; http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96612/u_file.htm#ARPLS069 -
How to know query execution time in sql plus
HI
I want to know the query execution time in sql plus along with statistics
I say set time on ;
set autotrace on ;
select * from view where usr_id='abcd';
if the result is 300 rows it scrolls till all the rows are retrieved and finally gives me execution time as 40 seconds or 1 minute.. (this is after all the records are scrolled )
but when i execute it in toad it gives 350 milli seconds..
i want to see the execution time in sql how to do this
database server 11g and client is 10g
regards
rajwhat is the difference between .. the
statistics gathered in sql plus something like this and the one that i get from plan_table in toad?
how to format the execution plan I got in sqlplus in a proper understanding way?
statistics in sqlplus
tatistics
0 recursive calls
0 db block gets
164 consistent gets
0 physical reads
0 redo size
29805 bytes sent via SQL*Net to client
838 bytes received via SQL*Net from client
25 SQL*Net roundtrips to/from client
1 sorts (memory)
0 sorts (disk)
352 rows processedexecution plan in sqlplus... how to format this
xecution Plan
0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=21 Card=1 Bytes=10
03)
1 0 HASH (UNIQUE) (Cost=21 Card=1 Bytes=1003)
2 1 MERGE JOIN (CARTESIAN) (Cost=20 Card=1 Bytes=1003)
3 2 NESTED LOOPS
4 3 NESTED LOOPS (Cost=18 Card=1 Bytes=976)
5 4 NESTED LOOPS (Cost=17 Card=1 Bytes=797)
6 5 NESTED LOOPS (OUTER) (Cost=16 Card=1 Bytes=685)
7 6 NESTED LOOPS (OUTER) (Cost=15 Card=1 Bytes=556
8 7 NESTED LOOPS (Cost=14 Card=1 Bytes=427)
9 8 NESTED LOOPS (Cost=5 Card=1 Bytes=284)
10 9 TABLE ACCESS (BY INDEX ROWID) OF 'USR_XR
EF' (TABLE) (Cost=4 Card=1 Bytes=67)
11 10 INDEX (RANGE SCAN) OF 'USR_XREF_PK' (I
NDEX (UNIQUE)) (Cost=2 Card=1)
12 9 TABLE ACCESS (BY INDEX ROWID) OF 'USR_DI
M' (TABLE) (Cost=1 Card=1 Bytes=217)
13 12 INDEX (UNIQUE SCAN) OF 'USR_DIM_PK' (I
NDEX (UNIQUE)) (Cost=0 Card=1)
14 8 TABLE ACCESS (BY INDEX ROWID) OF 'HDS_FCT'
(TABLE) (Cost=9 Card=1 Bytes=143)
15 14 INDEX (RANGE SCAN) OF 'HDS_FCT_IX2' (IND
EX) (Cost=1 Card=338)
16 7 TABLE ACCESS (BY INDEX ROWID) OF 'USR_MEDIA_
COMM' (TABLE) (Cost=1 Card=1 Bytes=129)
17 16 INDEX (UNIQUE SCAN) OF 'USR_MEDIA_COMM_PK'
(INDEX (UNIQUE)) (Cost=0 Card=1)
18 6 TABLE ACCESS (BY INDEX ROWID) OF 'USR_MEDIA_CO
MM' (TABLE) (Cost=1 Card=1 Bytes=129)
19 18 INDEX (UNIQUE SCAN) OF 'USR_MEDIA_COMM_PK' (
INDEX (UNIQUE)) (Cost=0 Card=1)
20 5 TABLE ACCESS (BY INDEX ROWID) OF 'PROD_DIM' (TAB
LE) (Cost=1 Card=1 Bytes=112)
21 20 INDEX (UNIQUE SCAN) OF 'PROD_DIM_PK' (INDEX (U
NIQUE)) (Cost=0 Card=1)
22 4 INDEX (UNIQUE SCAN) OF 'CUST_DIM_PK' (INDEX (UNIQU
E)) (Cost=0 Card=1)
23 3 TABLE ACCESS (BY INDEX ROWID) OF 'CUST_DIM' (TABLE)
(Cost=1 Card=1 Bytes=179)
24 2 BUFFER (SORT) (Cost=19 Card=22 Bytes=594)
25 24 INDEX (FAST FULL SCAN) OF 'PROD_DIM_AK1' (INDEX (UNI
QUE)) (Cost=2 Card=22 Bytes=594) -
Is this possible via SQL or not ?
Hi There
I have a scenario. Am not sure if this is possible via SQL or not.
For Example Consider two tables
T1
product_id location_id stock
A 1 100
T2
product_id location_id aging_phase received_qty
A 1 1 20
A 1 2 30
A 1 3 70
Now in T1 there is actual stock that is 100, while aging wise if i see stock that is 20+30+70=120
What i want is, generate a SQL that should yield quantity equals stock in T1 but with AGING PHASE wise break up
Result should be like this :
product_id location_id aging_phase qty
A 1 1 20
A 1 2 30
A 1 3 50
It would be a great help if somehow it becomes possible. Anyone have some solution ?
Regards
CapriCapri wrote:
May i have your email id please so that i can describe my problem in detail ?As Billy mentioned I would prefer not to do this. However, you can explain your problem here in detail. Please provide the following information:
1. Oracle version (SELECT * FROM V$VERSION)
2. Sample data in the form of CREATE / INSERT statements
3. Expected output.
4. The business logic to achieve the expected output.
5. Please use \ tags to surround #2 and #3. -
Import data from csv to SQL database
How to Import data from csv to SQL database through BLS-xMII?
Hi,
if you using Oracle, you may also use the bulk insert with MII. You can use the String List to XML parser to convert your CSV to XML, and then use a query that calls a stored procedure which does the bulk insert.
Also have a look at thread [read XML file into stored procedure|http://forums.sdn.sap.com/click.jspa?searchID=63850236&messageID=7455643].
Michael
Maybe you are looking for
-
How do I use my Zen on Windows 7? Any other way?
I downloaded all of the drivers, but the most recent driver for XP will not install for some reason. There aren't any for Vista or Windows 7. I am stuck with driver .2.. Windows media player won't play the files I have because the driver is outdated.
-
MacBook Air and Mac Mini Combination
I am trying to decide between a new (rumored to be out soon) MacBook Pro 15'' or a MacBook Air. If I take the latter option, I will need an accessible hard drive onto which to offload my photos, videos, and other large files. Would the combination of
-
How to create transparent text on a solid color background?
I want to create a transparent text on a solid color backround, and I need text transparency to go all the way to through the image (i.e. do not show the solid color background). I have the transparent background layer, the solid rectangle layer that
-
How to specify the font in a JList?
My application has four columns of data represented in a JList. The default font style does proportional spacing. I need to specify a fixed width font to control column alignment in the JList. Unless there's something like tab positions? If I can spe
-
Tinymce declarative component not working when added with PPR
I have a declarative component that i exposed in a resource catalog. This component uses <af:resource> to inject javascript in the page. the problem that i have is when in editing mode, and you add the component. the components <af:resource> is not y