SQLLoader Record Types and Multiple Rows
Ugh! I'm trying to load some Options data (Calls and Puts) which is a single csv record with both Calls and Puts and a Change (% Change is price) field which contains 'pc', '--', or a number.
I've tried multiple NULLIF conditions to set the 'pc' and '--' to null while retaining the Change value. I've tried WHEN statements to test for each 'pc', '--', and Change values. How should this be coded?
In addition, the record has two segments (Calls and Puts), how should the INTO table and WHEN be coded to insert two rows for each record?
Control file....
options (skip=3)
load data
infile 'OEX18Nov05.csv' "str '\r\n'" replace
into table OEX_Options
when (change='pc')
fields terminated by ',' optionally enclosed by '"'
(class char,
last char,
change char nullif (change='pc'),
bid char,
ask char,
volume char,
openinterest char)
into table OEX_Options
when (change='pc')
(class char,
last char,
change char nullif (change='--'),
bid char,
ask char,
volume char,
openinterest char)
into table OEX_Options
when (change<>'pc') and (change<>'--')
(class char,
last char,
change char,
bid char,
ask char,
volume char,
openinterest char)
... repeat above for second part of the record?
.OEX (CBOE),574.69,+3.52
Nov 18 2005 @ 17:44 ET (Data 15 Minutes Delayed)
Calls,Last Sale,Net,Bid,Ask,Vol,Open Int,Puts,Last Sale,Net,Bid,Ask,Vol,Open Int
05 Nov 400.0 (OXB KT-E),0,pc,174.40,174.60,0,0,05 Nov 400.0 (OXB WT-E),0.05,pc,0,0.05,0,1000
05 Nov 420.0 (OXB KD-E),0,pc,154.40,154.60,0,0,05 Nov 420.0 (OXB WD-E),0.05,pc,0,0.05,0,1680
05 Nov 440.0 (OXB KH-E),0,pc,134.40,134.60,0,0,05 Nov 440.0 (OXB WH-E),0.05,pc,0,0.05,0,6683
05 Nov 575.0 (OEB KO-E),0.05,-0.10,0,0.05,23911,32185,05 Nov 575.0 (OEB WO-E),0.30,-3.70,0.30,0.35,12116,1714
05 Nov 580.0 (OEB KP-E),0.05,--,0,0.05,1177,15520,05 Nov 580.0 (OEB WP-E),8.00,-1.10,5.20,5.40,127,300
05 Dec 570.0 (OEB LN-E),8.80,+1.70,8.80,9.10,4482,5083,05 Dec 570.0 (OEB XN-E),3.70,-1.50,3.70,4.10,4259,3658
05 Dec 575.0 (OEB LO-E),5.60,+1.20,5.60,5.90,4581,5895,05 Dec 575.0 (OEB XO-E),5.90,-1.80,5.70,5.90,1647,184
05 Dec 580.0 (OEB LP-E),3.20,+0.90,3.10,3.30,5500,10710,05 Dec 580.0 (OEB XP-E),8.70,-2.90,8.20,8.70,268,1384
Thanks,
LEO
Ugh! I'm trying to load some Options data (Calls and Puts) which is a single csv record with both Calls and Puts and a Change (% Change is price) field which contains 'pc', '--', or a number.
I've tried multiple NULLIF conditions to set the 'pc' and '--' to null while retaining the Change value. I've tried WHEN statements to test for each 'pc', '--', and Change values. How should this be coded?
In addition, the record has two segments (Calls and Puts), how should the INTO table and WHEN be coded to insert two rows for each record?
Control file....
options (skip=3)
load data
infile 'OEX18Nov05.csv' "str '\r\n'" replace
into table OEX_Options
when (change='pc')
fields terminated by ',' optionally enclosed by '"'
(class char,
last char,
change char nullif (change='pc'),
bid char,
ask char,
volume char,
openinterest char)
into table OEX_Options
when (change='pc')
(class char,
last char,
change char nullif (change='--'),
bid char,
ask char,
volume char,
openinterest char)
into table OEX_Options
when (change<>'pc') and (change<>'--')
(class char,
last char,
change char,
bid char,
ask char,
volume char,
openinterest char)
... repeat above for second part of the record?
.OEX (CBOE),574.69,+3.52
Nov 18 2005 @ 17:44 ET (Data 15 Minutes Delayed)
Calls,Last Sale,Net,Bid,Ask,Vol,Open Int,Puts,Last Sale,Net,Bid,Ask,Vol,Open Int
05 Nov 400.0 (OXB KT-E),0,pc,174.40,174.60,0,0,05 Nov 400.0 (OXB WT-E),0.05,pc,0,0.05,0,1000
05 Nov 420.0 (OXB KD-E),0,pc,154.40,154.60,0,0,05 Nov 420.0 (OXB WD-E),0.05,pc,0,0.05,0,1680
05 Nov 440.0 (OXB KH-E),0,pc,134.40,134.60,0,0,05 Nov 440.0 (OXB WH-E),0.05,pc,0,0.05,0,6683
05 Nov 575.0 (OEB KO-E),0.05,-0.10,0,0.05,23911,32185,05 Nov 575.0 (OEB WO-E),0.30,-3.70,0.30,0.35,12116,1714
05 Nov 580.0 (OEB KP-E),0.05,--,0,0.05,1177,15520,05 Nov 580.0 (OEB WP-E),8.00,-1.10,5.20,5.40,127,300
05 Dec 570.0 (OEB LN-E),8.80,+1.70,8.80,9.10,4482,5083,05 Dec 570.0 (OEB XN-E),3.70,-1.50,3.70,4.10,4259,3658
05 Dec 575.0 (OEB LO-E),5.60,+1.20,5.60,5.90,4581,5895,05 Dec 575.0 (OEB XO-E),5.90,-1.80,5.70,5.90,1647,184
05 Dec 580.0 (OEB LP-E),3.20,+0.90,3.10,3.30,5500,10710,05 Dec 580.0 (OEB XP-E),8.70,-2.90,8.20,8.70,268,1384
Thanks,
LEO
Similar Messages
-
Help in using record type and object type
Hi Experts,
I am new to object types and record types.
I want to return the output of this query using one OUT parameter
from the procedure using RECORD type or OBJECT type.
with out using refcursor.
SELECT empno,ename,sal FROM emp WHERE deptno=30;
Let us assume the query is returning 50 records.
I want to send those 50 records to OUT parameter using record type or object type.
Please provide the for the requirement code using RECORD TYPE and OBJECT TYPE separately.
Your earliest response is appreciated.
Thanks in advance.Hi All,
I have tried this.But it ising not work
CREATE OR REPLACE PACKAGE maultiplevalues_pkg
IS
TYPE t_record IS RECORD
(empno emp.empno%TYPE,
ename emp.ename%TYPE,
sal emp.sal%TYPE);
V_RECORD t_record;
TYPE t_type IS TABLE OF V_RECORD%TYPE;
PROCEDURE maultiplevalues_pROC(p_deptno IN emp.deptno%TYPE,
dept_result OUT t_type);
END;
CREATE OR REPLACE PACKAGE body maultiplevalues_pkg
IS
PROCEDURE maultiplevalues_pROC(p_deptno IN emp.deptno%TYPE,
dept_result OUT t_type)
is
begin
dept_result :=t_type();
for I in(
select EMPNO,ENAME,SAL from EMP WHERE deptno=p_deptno
LOOP
dept_result.extend;
dept_result(i).empno :=i.empno;
dept_result(i).ename :=i.ename;
dept_result(i).sal :=i.sal;
END LOOP;
END;
END;
Please help me OUT return multiple values through single OUT variable in a procedure.
Thanks. -
How to make RECORD for saving multiple rows for each employee..
Hi,
How can I create a record for saving multiple rows for each employee... (parent child relationship)
I have created all required fields, then created a record, and then created a page. in that page i dragged-n-dropped a scroll area on that page and dropped all required fields from record into that scroll-area.
whats is happening that its saving ONE (the first) record fine, but for the second record its not storing EMPLID for that row..
Will I have to make some change at RECORD level ?
OR Will i have to make some configuration in parent component ?Hi, the problem is solved. The record will be created in same way. just create more then one keys (allowing to make composite key in DB table)
-
How create a record type and a pl/sql table of that record type in database
Hi
I want to create a record type and then I want to create a PL/SQL table in the oracle 9i database.
I have done it in PL/SQL block.
But when I am trying to do it in database it is throwing me some error.
Could you please tell me how can I do that?
Regardsuser576726 wrote:
Hi
I want to create a record type and then I want to create a PL/SQL table in the oracle 9i database.
I have done it in PL/SQL block.
But when I am trying to do it in database it is throwing me some error.
Could you please tell me how can I do that?
RegardsRECORD type is supported only in PL/SQL for SQL you need to use OBJECT type. -
Calling Oracle Stored proc with record type and table Type
I have a oracle SP which takes record type and table Type which are used for order management.
Is there anay way to populate parameters with these datatypes and call the stored procedure using ODP.NET?
Please help.
Thanks in advanceHi,
ODP supports associative arrays and REF Cursors. There is no support for PLSQL table of records.
Jenny -
How does a record type and table type works
Hi,
How a record type and table type work for the ref cursor,
below i m giving an example but its giving me errors
can any one help me for this?
declare
type empcurtyp is ref cursor;
type rectype is record (veid t.emp_id%type, vename t.ename%type);
TYPE tabtype IS TABLE OF rectype;
empcv empcurtyp;
vtab tabtype;
begin
open empcv for select emp_id,ename from t;
loop
fetch empcv into vtab;
exit when empcv%notfound;
dbms_output.put_line(vtab.vename||vtab.veid);
end loop;
close empcv;
end;
here we hav table t and i m taking only two fields of the table t which r emp_id and ename.Hi,
What errors are you getting with this? From experience you don't need a loop to put the records into the ref cursor its usually done on block.
HTHS
L :-) -
How to return to the first record of a multiple row cursor (Forms 6i)
Hi all,
I had a bit of a search through here, but couldn't quite find the answer I'm after.
I have a multiple row cursor, which I feed into a multi-row block in Forms 6i. I have the following code:
OPEN CURSOR;
LOOP
FETCH CURSOR INTO :FIELD1, :FIELD2, :FIELD3, :FIELD4;
... do other code not related with cursor
EXIT WHEN CURSOR%NOTFOUND;
NEXT_RECORD;
END LOOP;Now, I use the Forms built-in NEXT_RECORD to move down through the records on the form and fill in each row from the db. However, once the block loads (this works correctly), the current item (ie where the typing cursor is left) is on the last record.
Obviously, I need the current item (after loading) to be on the first record. I tried using the Forms built-in FIRST_RECORD after the END LOOP command, but that gives me an ORA-06511 error (An attempt was made to open a cursor that was already open).
Does anyone know how I might be able to return to the first record of the block correctly?
Thanks in Advance,
Chris.Ok, I feel like a bit of a dolt.
I found that all cursors had to be closed before navigating back to the first record.
Case closed! :) -
BPM scenario:single sender message type and multiple receiver message types
Hi,
I am doing a scenario in which i have a single file which may contain different record types say type A,B,C.
I want to separate all records of type A, all records of type B, also all records of type C into different files.
so i will have 3 files of type record A,B,C in destination.
I am using File adapter on both sides.
I think one way may be using ccBPM.Can you please inform me how to achieve it using BPM.
If there is any other way Please mention.You can use multimapping (with or without BPM)
/people/jin.shin/blog/2006/02/07/multi-mapping-without-bpm--yes-it146s-possible ....without BPM
/people/sudharshan.aravamudan/blog/2005/12/01/illustration-of-multi-mapping-and-message-split-using-bpm-in-sap-exchange-infrastructure ....with BPM...is it that you will always get three output files? -
Needs Advice on Record Type and Views!!!
Hello all,
I have a package that returns a record type based on some arguments. I have a view that wants use a column from that record type. Obviously, I cannot call the package from the view.
I started looking into objects type, maybe use it instead of record type so that I can create a table on the object type and then use my object type table in my view. The problem is, I still have to call my package and passed the arguments to get the right data.
Could any of you help me direct me on how to deal with this kind of issues? I have also looked into member funtion but not sure. I am aware that I can write a function by itself and use the function in my view. But I was thinking in more of lines of completeness of my code that can serve all my needs, if possible.
A reply will be appreciated. Thank you.I read about Panasonic AG-DVX 100 Cam that shoot in 24f and before its print in FCP, the pull down takes it to 29f.
And the Sony i believe shoot near enough the same as the Panasonic.
So if that's the case would the conversion of FCP for the pull down come out alright, there is no point really in jumping to another Forum when the integration is with FCP!
Just need to get a cam that integrates well with FCP for a budget of under $4,000.00 and in the range of 29.97f,
Fr.BlayZay. -
Create JPub class for table of records/record types and access them
Hi,
I have the following object types in the database:
PERSON_REC with 3 fields and
PERSON_TAB table of PERSON_REC
I have created a Java class for PERSON_REC using JPub. The created class implements CustomDatum and CustomDatumFactory. How do I do it for table of records type i.e PERSON_TAB??
I have a stored procedure that has PERSON_TAB as a OUT parameter. How do retrieve the value from callablestatement? Is there a sample code anywhere. Kindly direct me.
I have seen sample code and documentation for PERSON_REC type from JPub but not for table of records; also there is no sample code for accessing them from JDBC. Please help me..
Thanks and regards,
Vadi.Vadi,
Try searching this forum's archives for the words "STRUCT" and "ARRAY".
Good Luck,
Avi. -
PL/SQL Record Type and Toplink
Can i call PL/SQL procedure having a parameter of record type in toplink. If yes, how it is possible?
Hi,
Record defines a representation of a database row as field=>value pairs.Whenever a query is exceuted the rows in the result set can be accessed thru RECORD interface.Can you be more elaborate on the question.
Are you trying to access the result set obtained after executing the Stored Proc using Record interface or you want to pass the Record as input parameter to Stored proc? -
Htmldb_mail and multiple rows
I would like to send via email the result of a query that returns multiple rows. How can I achieve that ? The following code example explains in detail what I would like to have - but it doesn't work like that.
DECLARE
remp varchar2(4000);
BEGIN
remp := 'select name from employee';
htmldb_mail.send(
p_to => '[email protected]',
p_from => '[email protected]',
p_body => 'These are the employees: '||remp||'',
p_subj => 'mail test');
END;
Thanks Tobiashi Tobias,
you need to use cursor, to collect all your employee names into one variable, after that include that variable in your mail body.
Declare
remp varchar2(4000);
CURSOR cur IS
SELECT name
FROM employee;
rec cur%ROWTYPE;
begin
OPEN cur;
LOOP
FETCH cur INTO rec;
EXIT WHEN cur%NOTFOUND;
remp:=remp||', '||rec.name;
END LOOP;
CLOSE cur;
htmldb_mail.send(
p_to => '[email protected]',
p_from => '[email protected]',
p_body => 'These are the employees: '||remp||'',
p_subj => 'mail test');
end;
hope this help. -
How to Make FUNCTION to return multiple column and multiple row output
Hi All,
Kindly Share ur Idea;Thanks in Advance;
i Have Table Demo.
table DEMO:
id name
1 a10
1 a11
1 a12
2 b10
2 b11
3 ccc
and the function is like:
create or replace function (p1 number) return varchar2 as
vid number;
vname varchar2(20);
begin
select id,name into vid,vname from demo where id=p1;
return v1;
end;
this function returns output for id=3;
BUT,
i need output as (for input as 1)
vid vname
1 a10
1 a11
1 a12A function returns a single datatype.
That datatype may be an atomic datatype (varchar2, number etc.) or it may be an object/record datatype, or even a collection datatype.
Where are you going to use this function? In PL/SQL or SQL?
If you are wanting to use it in SQL, then you would need a pipelined function e.g.
SQL> CREATE OR REPLACE TYPE myemp AS OBJECT
2 ( empno number,
3 ename varchar2(10),
4 job varchar2(10),
5 mgr number,
6 hiredate date,
7 sal number,
8 comm number,
9 deptno number
10 )
11 /
Type created.
SQL> CREATE OR REPLACE TYPE myrectable AS TABLE OF myemp
2 /
Type created.
SQL> CREATE OR REPLACE FUNCTION pipedata(p_min_row number, p_max_row number) RETURN myrectable PIPELINED IS
2 v_obj myemp := myemp(NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
3 BEGIN
4 FOR e IN (select *
5 from (
6 select e.*
7 ,rownum rn
8 from (select * from emp order by empno) e
9 )
10 where rn between p_min_row and p_max_row)
11 LOOP
12 v_obj.empno := e.empno;
13 v_obj.ename := e.ename;
14 v_obj.job := e.job;
15 v_obj.mgr := e.mgr;
16 v_obj.hiredate := e.hiredate;
17 v_obj.sal := e.sal;
18 v_obj.comm := e.comm;
19 v_obj.deptno := e.deptno;
20 PIPE ROW (v_obj);
21 END LOOP;
22 RETURN;
23 END;
24 /
Function created.
SQL> select * from table(pipedata(1,5));
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7369 SMITH CLERK 7902 17-DEC-1980 00:00:00 800 20
7499 ALLEN SALESMAN 7698 20-FEB-1981 00:00:00 1600 300 30
7521 WARD SALESMAN 7698 22-FEB-1981 00:00:00 1250 500 30
7566 JONES MANAGER 7839 02-APR-1981 00:00:00 2975 20
7654 MARTIN SALESMAN 7698 28-SEP-1981 00:00:00 1250 1400 30
SQL> select * from table(pipedata(6,10));
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7698 BLAKE MANAGER 7839 01-MAY-1981 00:00:00 2850 30
7782 CLARK MANAGER 7839 09-JUN-1981 00:00:00 2450 10
7788 SCOTT ANALYST 7566 19-APR-1987 00:00:00 3000 20
7839 KING PRESIDENT 17-NOV-1981 00:00:00 5000 10
7844 TURNER SALESMAN 7698 08-SEP-1981 00:00:00 1500 0 30
SQL> select * from table(pipedata(11,15));
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7876 ADAMS CLERK 7788 23-MAY-1987 00:00:00 1100 20
7900 JAMES CLERK 7698 03-DEC-1981 00:00:00 950 30
7902 FORD ANALYST 7566 03-DEC-1981 00:00:00 3000 20
7934 MILLER CLERK 7782 23-JAN-1982 00:00:00 1300 10
SQL>If you are using it in PL/SQL then just populating a collection datatype and returning that will do. Though you should question why you want to pass large amounts of data around like that first.
Explain your purpose and what you are intending to do and we can recommend the best way.
{message:id=9360002} -
Updating multpile tables and multiple rows - JDBC adapter
Hi,
The scenario is like this. i receive an Idoc which has header information and various line items (multiple occurrance of a segment). the hearder details have to be sent to one table, TableA, and all line items has to go to another table, TableB, and for each line item, a new row has to be inserted in TableB.
How can i acheive this using JDBC adapter? how should my data type look like? what are the settings i need to do in adapter config?
Thanks and Regards,
RashmiHi Rashmi,
You can use the following link for the JDBC adapter call :
http://help.sap.com/saphelp_nw04/helpdata/en/ae/d03341771b4c0de10000000a1550b0/frameset.htm
You need to provide the JDBC Driver, Connection,User Name and the password.
The data type structure you can take from the Bhavesh blog:
JDBC Receiver Adapter -- Synchronous Select Step by Step
Since you just need to update the tables, take only the sender side of the blog, i.e. the request part and configure the scenario accordingly.
Regards,
Sanjeev. -
Insert record behavior and multiple dynamic lists
I have a complex form that contains an insert record
behavior. Some of the fields are dynamic lists. My database has a
table to hold the static fields from the form and a number of
tables to hold the results from each dynamic list. I have the first
form and another form for review purposes. On the review form I am
getting an "Invalid argument supplied for foreach()" for each table
I try to insert the dynamic list results into. My investigation
leads me to believe that the arrays from the first form are being
subsumed by the actual insert action and that when my review form
is called, the arrays ($_POST) are no longer there. How do I ensure
that the arrays being set in part 1 of the Insert record behavior
will still be around for the review form? Any time I try to insert
code into the actual insert code, Dreamweaver duplicates the
behavior and tells me it can't decide which one to use.So it appears that I'm not the only person with this problem. One of the solutions I found was to use a Server.Transfer Server.Transfer("thank_you.asp")
instead of a Redirect.
This works however, now my form validation is broken.
Maybe you are looking for
-
Error 1 Error occurred in deployment step 'Activate Features': A timeout has occurred while invoking commands in SharePoint host process. 0 0 myProjectAssetsLists am getting the above error when i deploy my farm solution which is actually a "farm sol
-
HI All, we have a requirement where the due date should be a fix date, say 31st march 2007, irrespective of invoice date. Please let me know if this can be configured & how?
-
i m new to adobe captivate4 using first time... i need to insert a swf movie into adobe captivate 4 and have to generate scorm file for my elearning project... i am able to insert swf files... i inserted 10 swf file in 10 different file the problem h
-
How do you fix it when you get error Code: Too many Activations?
I am getting the following error code when I try to transfer books to my Sony PRS600 Reader using Adobe Digital Editions. My Operating System is Windows XP. Please help. I have called and got representatives who did not understand or we had a pro
-
Double tap mode - how do I get out?
Somehow I put my phone into mode where Siri reads me everything. The phone now requires a double tap to enter anything (ie: typing a number, letter, entering an app). How do I get my phone out of this mode?