How to use WHEN clause in sqlldr
I want to insert RECORDS in table which are having orgno column values greater then 100 in my datafile using sqlldr.
In WHEN clause in my control file if i mention WHEN (orgno > '100')
it gives me error :
Illegal combination of non-alphanumeric characters
WHEN (orgno < '500')
^
I am able to insert records when i use WHEN (orgno = '100') but not when i use > or < sign.
what to do???
Hello user8531525.
"The supported operators are equal (=) and not equal (!= or ne)"; replace the ne with less than and greater than signs. (http://www.mcs.csueastbay.edu/support/oracle/doc/10.2/server.102/b14215/ldr_control_file.htm)
Your filtering will need to be performed on the file itself or on the records after they are loaded. If your file is local to your database, consider using External Tables.
Luke
Please mark the answer as helpful or answered if it is so. If not, provide additional details.
Always try to provide create table and insert table statements to help the forum members help you better.
Edited by: Luke Mackey on Aug 5, 2010 2:58 PM
Similar Messages
-
How to use From clause as a block datasources
Hi,
I want to know how to use from clause as a block datasource.
Could anyone give me an example to do that? I couldn't find it
in the help file.
I sincerely ask someone help me.
Many thanks
DianaDiana,
I presume you are getting a "FRM-40505: error unable to perform
query" when you try to execute query. I suggest you select the
"Display Error" item from the "Help" menu to see the query that
Oracle is generating. If the query that Oracle generates as a
result of your "Query data source name" is not formed correctly,
you will get the FRM-40505 error.
Copy and paste the query that is displayed into SQLPLUS and test
to see what happens when you try to execute the query from
SQLPLUS. That will give you a better idea of what the cause of
the problem is.
From your example, a query that works should look like "select
c_no from (select c_no from books)".
Keep in mind that for blocks based on FROM clause, the query that
produces the data is of the form :
SELECT <all columns in the block>
FROM <select statement entered in the "Query Data Source Name"
blockproperty>
The data source for the block is the select statement embedded in
the from clause.
Hope this helps. -
Can any one tell me how to use EXISTS clause inplace of IN operator.
Hi All,
Can any one tell me how to use EXISTS clause AND (JC.EMPL_ID, JC.EMPL_RCD) inplace of IN operator.
SELECT COUNT (1)
FROM SYSADM.OHR_PERS_CURR PC
, SYSADM.OHR_JOB_CURR JC
WHERE PC.EMPL_ID = JC.EMPL_ID
AND (JC.EMPL_ID, JC.EMPL_RCD) in (
SELECT HS.EMPL_ID, HS.EMPL_RCD
FROM SYSADM.HU_SCRTY_JOB HS, ODSHR.OHR_SCRTY_USER_CFG OS
WHERE HS.HU_SCRTY_CFG_ID = OS.HU_SCRTY_CFG_ID
AND OS.DB_LOGIN = USER)
Thank you.SELECT COUNT (1)
FROM SYSADM.OHR_PERS_CURR PC
, SYSADM.OHR_JOB_CURR JC
WHERE PC.EMPL_ID = JC.EMPL_ID
AND EXISTS (
SELECT null
FROM SYSADM.HU_SCRTY_JOB HS, ODSHR.OHR_SCRTY_USER_CFG OS
WHERE HS.HU_SCRTY_CFG_ID = OS.HU_SCRTY_CFG_ID
AND OS.DB_LOGIN = USER
AND HS.EMPL_ID = JS.EMPL_ID AND HS.EMPL_RCD = JC.EMPL_RCD)
But why ?
Rgds. -
How to specify when clause in a database trigger
I would like to create a database trigger that only fires on database create statements. In particular, it only needs to fire when tables with a specific prefix fire.
I'd like to be able to specify something in the when clause along the lines of :
CREATE OR REPLACE
TRIGGER CAPTURE_STATS
after CREATE ON rtrei.schema
WHEN ( NEW.table_name like 'RT_FOO%' )
begin
add_stats_capture( :new.min_range, :new.max_range);
end;
It looks like I should be able to use a when as part of a database trigger, but I have no idea what new would be defined to be so that I could use it... perhaps it is an object and the clause would look something like
when (new.objecttype = 'TABLE' and new.name like 'RT_FOO%')?
Any ideas? I've searched through the docs, but have not been able to find anything relevant.
thanks very much,
RobinYou can use the WHEN clause with DDL triggers. You can move Todd's IF-THEN clause up into the WHEN clause.
See http://download-west.oracle.com/docs/cd/B14117_01/appdev.101/b10795/adfns_ev.htm for all of the System-Defined Event Attributes.
CREATE OR REPLACE TRIGGER capture_stats
AFTER CREATE ON SCHEMA
WHEN (ora_dict_obj_type = 'TABLE' AND ora_dict_obj_name LIKE 'RT_FOO%')
BEGIN
--Do whatever here.
END capture_stats; -
How to use where clause with get statement in LDB programs
Hi All,
I am using logical databse in my report program.I am not getting how to use the where clause in the get statement is it possible to use?or if not possible only option is we should filter it after get statment is right?Can you please some body throw some idea on this?
Regards
MaheshHi,
Reffer these links
http://help.sap.com/saphelp_nw04/helpdata/en/9f/db9bfa35c111d1829f0000e829fbfe/content.htm
http://help.sap.com/saphelp_nw04/helpdata/en/9f/db9b5e35c111d1829f0000e829fbfe/frameset.htm
http://help.sap.com/saphelp_nw04/helpdata/en/c6/8a15381b80436ce10000009b38f8cf/frameset.htm
/people/srivijaya.gutala/blog/2007/03/05/why-not-logical-databases
reward if helpful
Thanks,
Suma. -
How to use WHERE Clause in BPEL
Hi ,
i am trying to use where clause in DB adapter but its not working.
my query is "select empname from employee where empid = &a"
can any body tell me what is the reason its npt working?
and how can i retrive data form DB?Hi,
You are thinking perfectly fine. The solution what I suggested was
select ename from emp where empno=?
And the solution provided by you was
SELECT first_name, last_name FROM per_all_people_f WHERE person_id = #p_person_id
There is no problem with the above mentioned select statements.
I just want to say that if you see closely, internal logic changes #parameter name to ?. So both the logics are right.
Cheers,
Abhi... -
How to use when-validate-item in the form personalization?
Dear all,
I want to use when-validate-item trigger in the form personalization on a specific item. while in the same time the when-validate-item is not included in the trigger event list.
Please advice & Thanks in advance
Ashraf AshourUse condition. If you are validating a record, just out the desired check in the condition field for that specific item.
Thanks
Nagamohan -
Using When clause in datafile witch have FIELDS TERMINATED BY ';' option
Dear all
For example if my datafile is the following :
E;11;
D;14;16;
Is'it possible to me having the following control file to load data in a table:
If yes? What is the correct syntax? If no what can i do to obtain my goal.
Thx for help!!!
LOAD DATA
TRUNCATE
INTO TABLE Tab1
when (1) ='E'
FIELDS TERMINATED BY ';' TRAILING NULLCOLS
(Type_Ligne CHAR,
Nombre INTEGER EXTERNAL)
INTO TABLE Tab1
when (1) ='D'
FIELDS TERMINATED BY ';' TRAILING NULLCOLS
(Type_Ligne CHAR,
Nombre INTEGER EXTERNAL,
Nombre2 INTEGER EXTERNAL)@OP,
You missed specifying POSITION for Type_Ligne in the second WHEN. This is describe well in the following documentation.
SQL*Loader Control File Reference
VERBATIM from the documentation...
The POSITION parameter in the second INTO TABLE clause is necessary to load this data correctly. It causes field scanning to start over at column 1 when checking for data that matches the second format. Without it, SQL*Loader would look for the recid field after dname.
I tried your control file and it worked fine loading the first record but not the second.
create table Tab1
(Type_Ligne char(1),Nombre int, Nombre2 int);
LOAD DATA
INFILE *
TRUNCATE
INTO TABLE Tab1
when (1) ='E'
FIELDS TERMINATED BY ';' TRAILING NULLCOLS
(Type_Ligne CHAR,
Nombre INTEGER EXTERNAL)
INTO TABLE Tab1
when (1) ='D'
FIELDS TERMINATED BY ';' TRAILING NULLCOLS
(Type_Ligne POSITION(1) CHAR, ---- <<<<<<<<<<< I added POISTION(1) for this field
Nombre INTEGER EXTERNAL,
Nombre2 INTEGER EXTERNAL)
BEGINDATA
E;11;
D;14;16;
ENDDATA
Run SQLLDR...
C:\TEMP>sqlldr control=sqlloader.sql userid=hr/hr
SQL*Loader: Release 12.1.0.1.0 - Production on Sun Dec 29 12:45:01 2013
Copyright (c) 1982, 2013, Oracle and/or its affiliates. All rights reserved.
Path used: Conventional
Commit point reached - logical record count 2
Commit point reached - logical record count 3
Table TAB1:
1 Row successfully loaded.
Table TAB1:
1 Row successfully loaded.
Check the log file:
sqlloader.log
for more information about the load.
C:\TEMP>
The data got loaded.
> select * from tab1
TYPE_LIGNE NOMBRE NOMBRE2
E 11
D 14 16
Hope this helps.
vr,
Sudhakar -
Need help to use 'When' clause in CTL file
Hi,
I have a requirement
in ctl file while loading file names in to a table we need to ignore if the filename already exist in the table
eg:
load infile.txt
into a
when filename not in (select filename from a) append
filename varchar(1000)
is it possible?? any way to achieve this?? Pleas help..
Thanks in advance..user3647602 wrote:
Hi,
I have a requirement
in ctl file while loading file names in to a table we need to ignore if the filename already exist in the table
eg:
load infile.txt
into a
when filename not in (select filename from a) append
filename varchar(1000)
is it possible?? any way to achieve this?? Pleas help..
Thanks in advance..Easiest method i can think of would be to use an EXTERNAL TABLE instead of SQL LOADER.
Much more flexible.
Cheers, -
How to use model clause without hard coding the values in it?
Query
select acct_no,
gl_code,
CASE
WHEN entry_type_label IN ('Earned Revenue') THEN
'Earned Revenue'
ELSE
'Deferred Revenue Credit'
END AS entry_type_label,
CASE
WHEN entry_type_label IN ('Opening Balance') THEN
'Opening Balance'
WHEN entry_type_label IN ('Deferred Revenue Credit') THEN
'Invoice Amount'
WHEN entry_type_label IN ('Earned Revenue') THEN
'Earned Revenue'
WHEN entry_type_label IN ('Closing Balance') THEN
'Closing Balance'
ELSE
'Deferred Revenue Credit'
END AS label,
entry_type_no,
orig_chg_start_date,
period_no,
-amt as amt
from revrec_test
WHERE acct_no = 1788562
AND entry_type_no IN (2, 4) model dimension by(acct_no,
gl_code,
entry_type_label,
entry_type_no,
orig_chg_start_date,
period_no) measures(amt) rules upsert
all(amt 1788562,
'UNEARNED-10011561',
'Opening Balance',
2,
'02-OCT-17 08.30.00 AM',
190 = 0,
amt 1788562,
'UNEARNED-10011561',
'Closing Balance',
2,
'02-OCT-17 08.30.00 AM',
190 = amt 1788562,
'UNEARNED-10011561',
'Deferred Revenue Credit',
2,
'02-OCT-17 08.30.00 AM',
190 - amt 1788562,
'EARNED-10011561',
'Earned Revenue',
4,
'02-OCT-17 08.30.00 AM',
190,
amt 1788562,
'UNEARNED-10011561',
'Opening Balance',
2,
'02-OCT-17 08.30.00 AM',
191 = amt 1788562,
'UNEARNED-10011561',
'Closing Balance',
2,
'02-OCT-17 08.30.00 AM',
190,
amt 1788562,
'UNEARNED-10011561',
'Deferred Revenue Credit',
2,
'02-OCT-17 08.30.00 AM',
191 = 0,
amt 1788562,
'UNEARNED-10011561',
'Closing Balance',
2,
'02-OCT-17 08.30.00 AM',
191 =
(amt 1788562, 'UNEARNED-10011561', 'Opening Balance', 2,
'02-OCT-17 08.30.00 AM', 191 + amt 1788562, 'UNEARNED-10011561',
'Deferred Revenue Credit', 2, '02-OCT-17 08.30.00 AM', 191) - amt
1788562,
'EARNED-10011561',
'Earned Revenue',
4,
'02-OCT-17 08.30.00 AM',
191,
amt 1788562,
'UNEARNED-10011561',
'Opening Balance',
2,
'02-OCT-17 08.30.00 AM',
192 = amt 1788562,
'UNEARNED-10011561',
'Closing Balance',
2,
'02-OCT-17 08.30.00 AM',
191,
amt 1788562,
'UNEARNED-10011561',
'Deferred Revenue Credit',
2,
'02-OCT-17 08.30.00 AM',
192 = 0,
amt 1788562,
'UNEARNED-10011561',
'Closing Balance',
2,
'02-OCT-17 08.30.00 AM',
192 =
(amt 1788562, 'UNEARNED-10011561', 'Opening Balance', 2,
'02-OCT-17 08.30.00 AM', 192 + amt 1788562, 'UNEARNED-10011561',
'Deferred Revenue Credit', 2, '02-OCT-17 08.30.00 AM', 192) - amt
1788562,
'EARNED-10011561',
'Earned Revenue',
4,
'02-OCT-17 08.30.00 AM',
192,
amt 1788562,
'UNEARNED-10011561',
'Opening Balance',
2,
'02-OCT-17 08.30.00 AM',
193 = amt 1788562,
'UNEARNED-10011561',
'Closing Balance',
2,
'02-OCT-17 08.30.00 AM',
192,
amt 1788562,
'UNEARNED-10011561',
'Deferred Revenue Credit',
2,
'02-OCT-17 08.30.00 AM',
193 = 0,
amt 1788562,
'UNEARNED-10011561',
'Closing Balance',
2,
'02-OCT-17 08.30.00 AM',
193 =
(amt 1788562, 'UNEARNED-10011561', 'Opening Balance', 2,
'02-OCT-17 08.30.00 AM', 193 + amt 1788562, 'UNEARNED-10011561',
'Deferred Revenue Credit', 2, '02-OCT-17 08.30.00 AM', 193) - amt
1788562,
'EARNED-10011561',
'Earned Revenue',
4,
'02-OCT-17 08.30.00 AM',
193)
ORDER BY period_no, entry_type_no;
The above query works fine. But i have hard coded the values. I want to do the same operation for different account number which is going to have different periodic no. How can I achieve it?
Thanks in advance.Create Statement
CREATE TABLE table_one(
ACCT_NO NUMBER(38),
GL_CODE VARCHAR2(300),
ENTRY_TYPE_LABEL CHAR(50),
ENTRY_TYPE_NO NUMBER,
ORIG_CHG_START_DATE TIMESTAMP(0) WITH LOCAL TIME ZONE,
ORIG_CHG_END_DATE TIMESTAMP(0) WITH LOCAL TIME ZONE,
PERIOD_NO NUMBER(38),
AMT NUMBER(38,10)
Insert Statement
INSERT ALL
INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1001,'U-11561','Deferred Revenue Debit',3,'02-OCT-17 08.30.00 AM','01-JAN-18 01.30.00 PM',100,13.87)
INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1001,'E-11561','Earned Revenue',4,'02-OCT-17 08.30.00 AM','01-JAN-18 01.30.00 PM',102,-14.83)
INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1001,'E-11561','Earned Revenue',4,'02-OCT-17 08.30.00 AM','01-JAN-18 01.30.00 PM',101,-14.35)
INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1001,'E-11561','Earned Revenue',4,'02-OCT-17 08.30.00 AM','01-JAN-18 01.30.00 PM',100,-13.87)
INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1001,'U-11561','Deferred Revenue Debit',3,'02-OCT-17 08.30.00 AM','01-JAN-18 01.30.00 PM',103,0.95)
INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1001,'U-11561','Deferred Revenue Debit',3,'02-OCT-17 08.30.00 AM','01-JAN-18 01.30.00 PM',102,14.83)
INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1001,'U-11561','Deferred Revenue Debit',3,'02-OCT-17 08.30.00 AM','01-JAN-18 01.30.00 PM',101,14.35)
INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1001,'E-11561','Earned Revenue',4,'02-OCT-17 08.30.00 AM','01-JAN-18 01.30.00 PM',103,-0.95)
INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1001,'U-11561','Deferred Revenue Credit',2,'02-OCT-17 08.30.00 AM','01-JAN-18 01.30.00 PM',100,-44)
INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Deferred Revenue Debit',3,'17-NOV-13 09.30.00 AM','16-FEB-14 09.30.00 AM',106,44.91)
INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Accounts Receivable',1,'17-NOV-13 09.30.00 AM','16-FEB-14 09.30.00 AM',104,60)
INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Deferred Revenue Debit',3,'20-DEC-13 09.30.00 AM','16-FEB-14 09.30.00 AM',105,3.93)
INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Deferred Revenue Debit',3,'20-DEC-13 09.30.00 AM','16-FEB-14 09.30.00 AM',106,11.75)
INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Deferred Revenue Debit',3,'20-DEC-13 09.30.00 AM','16-FEB-14 09.30.00 AM',107,6.86)
INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Deferred Revenue Debit',3,'20-DEC-13 09.30.00 AM','16-FEB-14 09.30.00 AM',105,-7.82)
INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Deferred Revenue Debit',3,'20-DEC-13 09.30.00 AM','16-FEB-14 09.30.00 AM',106,-23.47)
INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Deferred Revenue Debit',3,'20-DEC-13 09.30.00 AM','16-FEB-14 09.30.00 AM',107,-13.69)
INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Earned Revenue',4,'20-DEC-13 09.30.00 AM','16-FEB-14 09.30.00 AM',107,-6.86)
INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Earned Revenue',4,'20-DEC-13 09.30.00 AM','16-FEB-14 09.30.00 AM',105,7.82)
INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Earned Revenue',4,'20-DEC-13 09.30.00 AM','16-FEB-14 09.30.00 AM',106,23.47)
INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Earned Revenue',4,'20-DEC-13 09.30.00 AM','16-FEB-14 09.30.00 AM',107,13.69)
INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Earned Revenue',4,'17-NOV-13 09.30.00 AM','16-FEB-14 09.30.00 AM',104,-9.13)
INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Earned Revenue',4,'17-NOV-13 09.30.00 AM','16-FEB-14 09.30.00 AM',105,-44.91)
INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Earned Revenue',4,'17-NOV-13 09.30.00 AM','16-FEB-14 09.30.00 AM',106,-44.91)
INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Earned Revenue',4,'17-NOV-13 09.30.00 AM','16-FEB-14 09.30.00 AM',107,-35.91)
INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Earned Revenue',4,'20-DEC-13 09.30.00 AM','16-FEB-14 09.30.00 AM',105,-3.93)
INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Deferred Revenue Debit',3,'17-NOV-13 09.30.00 AM','16-FEB-14 09.30.00 AM',105,44.91)
INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Deferred Revenue Debit',3,'17-NOV-13 09.30.00 AM','16-FEB-14 09.30.00 AM',104,9.13)
INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Earned Revenue',4,'20-DEC-13 09.30.00 AM','16-FEB-14 09.30.00 AM',106,-11.75)
INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Deferred Revenue Credit',2,'20-DEC-13 09.30.00 AM','16-FEB-14 09.30.00 AM',105,38.48)
INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Deferred Revenue Credit',2,'20-DEC-13 09.30.00 AM','16-FEB-14 09.30.00 AM',105,-19.24)
INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Deferred Revenue Credit',2,'17-NOV-13 09.30.00 AM','16-FEB-14 09.30.00 AM',104,-60)
INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Accounts Receivable',1,'20-DEC-13 09.30.00 AM','16-FEB-14 09.30.00 AM',105,38.48)
INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Accounts Receivable',1,'20-DEC-13 09.30.00 AM','16-FEB-14 09.30.00 AM',105,19.24)
INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Deferred Revenue Debit',3,'17-NOV-13 09.30.00 AM','16-FEB-14 09.30.00 AM',107,35.91)
SELECT * FROM dual;
Expected Result
S.NO
ACCT_NO
GL_CODE
ENTRY_TYPE_LABEL
ENTRY_TYPE_NO
ORIG_CHG_START_DATE
PERIOD_NO
AMT
DESCRIPTION
1
1001
U-11561
Deferred Revenue Credit
2
02-OCT-17 08.30.00 AM
100
0
Opening Account
2
1001
U-11561
Deferred Revenue Credit
2
02-OCT-17 08.30.00 AM
100
44
Invoice
3
1001
E-11561
Earned Revenue
4
02-OCT-17 08.30.00 AM
100
13.87
Invoice Paid
4
1001
U-11561
Deferred Revenue Credit
2
02-OCT-17 08.30.00 AM
100
30.13
Closing Account
5
1001
U-11561
Deferred Revenue Credit
2
02-OCT-17 08.30.00 AM
101
30.13
Opening Account
6
1001
U-11561
Deferred Revenue Credit
2
02-OCT-17 08.30.00 AM
101
0
Invoice
7
1001
E-11561
Earned Revenue
4
02-OCT-17 08.30.00 AM
101
14.35
Invoice Paid
8
1001
U-11561
Deferred Revenue Credit
2
02-OCT-17 08.30.00 AM
101
15.78
Closing Account
9
1001
U-11561
Deferred Revenue Credit
2
02-OCT-17 08.30.00 AM
102
15.78
Opening Account
10
1001
U-11561
Deferred Revenue Credit
2
02-OCT-17 08.30.00 AM
102
0
Invoice
11
1001
E-11561
Earned Revenue
4
02-OCT-17 08.30.00 AM
102
14.83
Invoice Paid
12
1001
U-11561
Deferred Revenue Credit
2
02-OCT-17 08.30.00 AM
102
0.95
Closing Account
13
1001
U-11561
Deferred Revenue Credit
2
02-OCT-17 08.30.00 AM
103
0.95
Opening Account
14
1001
U-11561
Deferred Revenue Credit
2
02-OCT-17 08.30.00 AM
103
0
Invoice
15
1001
E-11561
Earned Revenue
4
02-OCT-17 08.30.00 AM
103
0.95
Invoice Paid
16
1001
U-11561
Deferred Revenue Credit
2
02-OCT-17 08.30.00 AM
103
0
Closing Account
Description
We must start opening account as zero and end with closing account as zero by doing manipulation with invoice and invoice paid.
Process
Initial Stage
Subsequent stage
Opening Account
0
(=closing Account)
Invoice
max value of account no which has entry type no 2
0
Invoice Paid
taken from the field amount which has entry type no 4
taken from the field amount which has entry type no 4
Closing Account
(=[opening account + invoice] - invoice paid)
(=[opening account + invoice] - invoice paid)
Note
1) Each account may have different periodic no.
2) Some account may have more than 4 distinct period no and less than 4 distinct periodic no.
3) Description column from expected result is not an part of table. It is been added for easier understanding. -
How to use "where" clause in modify statement
Hi
can any1 telll me is it possible to use a where clause in a modify statemetn. I want to use modify statemetn to insert a new recoed in a database table.
Regards
Sabahuddin AhmedMODIFY itab - itab_lines
Syntax :
... itab FROM wa TRANSPORTING comp1 comp2 ... WHERE log_exp.
With these additions the MODIFY statement assigns the content of the comp1 comp2 ... components of the wa work area specified after TRANSPORTING to all lines in the itab table that meet the logical condition log_exp. The wa work area must be compatible with the line type of the internal table.
The TRANSPORTING addition has the same effect as changing individual lines. The WHERE addition can only be specified together with the TRANSPORTING addition. After WHERE, any logical expression can be specified in which the first operand of each individual comparison is a component of the internal table. All logical expressions are therefore possible, with the exception of IS ASSIGNED, , and IS SUPPLIED. It is not possible to dynamically specify a component using bracketed character-type data objects.
While for standard tables and hashed tables all lines in the internal table are checked for the logical expression of the WHERE statement, for sorted tables, optimized access can be achieved by checking at least one opening part of the table key for parity using AND linked queries in the logical expression.
Example
Change the contents of the planetype component for all lines in the sflight_tab internal table in which this component contains the value p_plane1 to the value p_plane2.
PARAMETERS: p_carrid TYPE sflight-carrid,
p_connid TYPE sflight-connid,
p_plane1 TYPE sflight-planetype,
p_plane2 TYPE sflight-planetype.
DATA sflight_tab TYPE SORTED TABLE OF sflight
WITH UNIQUE KEY carrid connid fldate.
DATA sflight_wa TYPE sflight.
SELECT *
FROM sflight
INTO TABLE sflight_tab
WHERE carrid = p_carrid AND
connid = p_connid.
sflight_wa-planetype = p_plane2.
MODIFY sflight_tab FROM sflight_wa
TRANSPORTING planetype WHERE planetype = p_plane1.
reward if useful -
How to use "with clause query" in DBadapter
Hi all,
I need to implement a "with clause" query in oracle soa 11g bpel. When i put the query in db adapter in pure sql, the schema is not getting generated properly. Can any one suggest a solution to my problem.
Regards,
KaushikPure SQL won't work because it is expecting the first word in the SQL to be SELECT (or INSERT,UPDATE,DELETE).
If your query is WITH ... SELECT ...
try this:
delete everything before SELECT. Copy and paste the generated XSD to another window. The SQL test may fail, but that will just mean that it couldn't fill in the types of the columns in the SELECT ... FROM list. You can always do that yourself by hand editing the XSD (including in the wizard before you hit next). Then put back the WITH ... clause before the remaining SELECT .... If the XSD gets overwritten, copy the version you saved in the other window and paste it over top. Then hit next and the runtime should still work.
Keep in mind that SQL is very complex and hard to fully parse in the UI. However the minimum information the DbAdapter needs is quite limited; basically just the name and number of columns that are coming back. The XSD is meant to be editable in the wizard if the SQL is too complex.
Thanks
Steve -
HOW TO USE RETURNING CLAUSE USING MERGE
Hello All,
Is there a way to find out the rows that got inserted into a table using the merge statement.
Merge statement is given below. I need to know what rows were inserted when this query got executed.
MERGE INTO PR P USING
(SELECT A.ID, A.NAME, A.PENSION FROM MEMBER_PROFILE A, PROFILE B WHERE A.ID=B.ID)RES
ON P.PENSION = RES.PENSION
WHEN MATCHED THEN
UPDATE SET P.MOD_DATE= SYSDATE
WHEN NOT MATCHED THEN
INSERT(P.ID, P.NAME, P.PENSION)
VALUES(RES.ID, RES.NAME, RES.PENSION)However there are some solutions
So if you really need to track this data you can play with something like this:
Let’s try to add columns row_trunsaction_id (and may be transaction_type) to you merged table. Consider you get a new transaction id before a merge and insert id and type in your table if is new record.
You also can use Date: you should have row creation date and row update date
When insert, fresh creation date inserted, when update, update_date updated
After all you may query this information right after transaction and put it in you log table. -
Hello,
I am using sapnwrfc for perl to get few information about SAP system. To get the Applications pruning on SAP system i need to use two tables DF14AVD and DF14T to get Application Name and Description. table DF14T contains description of the application.
I want to know using QUERY_TABLE how i can combined it and get desired result.
For ex. FCTR_ID is present in both the table. FCTR_ID which are present in DF14AVD table, i want to retrieve short description from DF14T .
Any idea how i can do this?
AmitHi,
You can refer to the following link.
http://help.sap.com/erp2005_ehp_04/helpdata/EN/4b/38b618068911d295300000e8353423/frameset.htm
Thank You.
Regards,
Dhanalakshmi L -
How to use in clause with variable elements with a prepared statement?
Is there any way to use a prepared statement for a query which incorporates an in clause with unknown number of elements in the list?
null<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Iraj ():
Is there any way to use a prepared statement for a query which incorporates an in clause with unknown number of elements in the list?<HR></BLOCKQUOTE>
Sorry, can't be done. The PreparedStatement is precomplied, so you can't have variable number of params or unknown number of elements in a list.
Maybe you are looking for
-
NW04 Testdrive Dump when using ABAP Webservice whizard
Hello, I have NW4 running on FC5. When I try to create a webservice in SE80 the whizard dumps: Runtime Errors GEN_NO_GENINFO_FOR_DATID Occurred on 21.02.2008 at 10:08:16 No generation information for DATID "%_#D18404". What happe
-
Let me know if you have any answers.
-
Best way to keep a BSO and ASO in sync?
Hi all, I have been trying to find the best way to keep in sync the same outline. Source is a planning cube, while the "target" is an ASO one for reporting purposes. My approach has been to use ODI in order to load the metadata in the Planning app, b
-
DataMgr.c,Line:9529,Index out of range
I think this the correct forum based on a search for "DataMg" errors. I was deleting some e-mails off m Tungsten E. Deleted 12 or more of them without a problem. I went back to the screen that listed all of the e-mails and immediately a Fatal Erro
-
"PHOTOS FOUND IN THE iPHOTO LIBRARY THAT WERE NOT IMPORTED"
Ever since I imported some videos from a memory stick about 2 weeks ago, my iPhoto opens with the above message and then says that I need to save some photos that were not imported, and then precedes to create an empty folder of 'RECOVERED PHOTOS" wi