How to use LKM sql Incremetal update
Hi ,
I am using ODI to intergrate the SQL server database to Oracle. I have created interface where it selects all the records and puts in to Staging area (Oracle). I want to have only daily incements to add to the staging stable (initial full load) and keep append only incrementals.
I am using LKM SQL to oracle and IKM oracle incremental update. when I run it is appending all the rows instead of increments. I have defined unique key also. but can't this work with duplicates . I have a date in the table. but the date will contain duplicates as it is a transactional data. I want to roleup using the date. I need only the increments to be loaded in staging area.
help requested.
Veer
Hi,
I noticed this as well; the IKM compares the complete resultset of the flow in the Interface with the rows in the target-table. In case you have a datestamp (sysdate) in your flow, the resultsets will always be different.
What I did to overcome this is, is edit the IKM (make a duplicate first) and make sure that the check will not be done on the complete resultset, but only on the Unique Key columns.
For this, I have edited step 132 in the IKM and removed the code that generates the "minus select .... from ..."
I hope this helps you.
Steffen
Similar Messages
-
Can anybody please send me a small program on How to Use Dynamic SQL.
How to execute and run give details.
Thanks
nullYou can certainly use the INTO (and USING) clauses of EXECUTE IMMEDIATE to pass in and return data, i.e.
EXECUTE IMMEDIATE sqlStmt
USING variable1, variable2
INTO output1, output2The more complex the statement, however, the more appropriate DBMS_SQL is. DBMS_SQL also has the potential to allow you to use bind variables rather than reparsing the statement many times.
Justin
Distributed Database Consulting, Inc.
http://www.ddbcinc.com/askDDBC -
Hi experts, how to use open sql to read data from one " maintenance view"?
i want to use this part of data within report ,so how to use open sql statement to read data from one " maintenance view"?
Hi
You can't use OPEN SQl statements to fetch data from maintenance view
You have to use only Database views
see the different types of views and the difference
The followings are different types of views:
- Database View (SE11)
Database views are implement an inner join, that is, only records of the primary table (selected via the join operation) for which the corresponding records of the secondary tables also exist are fetched. Inconsistencies between primary and secondary table could, therefore, lead to a reduced selection set.
In database views, the join conditions can be formulated using equality relationships between any base fields. In the other types of view, they must be taken from existing foreign keys. That is, tables can only be collected in a maintenance or help view if they are linked to one another via foreign keys.
- Help View ( SE54)
Help views are used to output additional information when the online help system is called.
When the F4 button is pressed for a screen field, a check is first made on whether a matchcode is defined for this field. If this is not the case, the help view is displayed in which the check table of the field is the primary table. Thus, for each table no more than one help view can be created, that is, a table can only be primary table in at most one help view.
- Projection View
Projection views are used to suppress or mask certain fields in a table (projection), thus minimizing the number of interfaces. This means that only the data that is actually required is exchanged when the database is accessed.
A projection view can draw upon only one table. Selection conditions cannot be specified for projection views.
- Maintenance View ( SE54 )
Maintenance views enable a business-oriented approach to looking at data, while at the same time, making it possible to maintain the data involved. Data from several tables can be summarized in a maintenance view and maintained collectively via this view. That is, the data is entered via the view and then distributed to the underlying tables by the system.
Please have a look at below link. It will help you.
http://help.sap.com/saphelp_nw04/helpdata/en/cf/21ed06446011d189700000e8322d00/frameset.htm
for more detailed info look on:
http://www.sap-img.com/abap/what-is-the-different-types-and-usage-of-views.htm
https://www.sdn.sap.com/irj/sdn/wiki?path=/display/home/abap+dictionary&
Reward points for useful Answers
Regards
Anji -
How do you use PL/SQL to update a view?
Hi there, I know how to use SQL to create and update a view. I am using it to pull data for a specific date.
But now I want to find a way to parametized it (ie. the date) so that it can be run like a program each day (based on system date) to pull the latest data. I am thinking of using PL/SQL but not sure how it can be done.
DECLARE
run_date DATE := '10/12/2009';
BEGIN
END
Can someone shed some light on how I can update a view? Thanks alot.Try this
DECLARE
run_date DATE := '10/12/2009';
BEGIN
execute imeediate 'create view view_name as select * from dual';
END -
How to use FM VIEW_MAINTENANCE_NO_DIALOG for updating values in views
Hi all,
I got a scenario to update the maintainenace view V_T001S based on the user inputs through a program.
I'm thinking to use this FM VIEW_MAINTENANCE_NO_DIALOG , but im getting lot of errors.
Please let me know if you have any other solutions for this scenario.
Thanks in Advance.
Best regards,
Sekhar.
Resolved.. thanks
Edited by: Chandrasekhar Raju on Mar 29, 2011 6:55 AMHi,
you could use Dynamic SQL /Execute immediate to run DDL from a stored procedure.
http://download-uk.oracle.com/docs/cd/B10501_01/appdev.920/a96624/11_dynam.htm
Could you please tell why do you want to create a materialized view in stored procedure ?
How frequently you will runt this procedure . It would is better to create a MV once and use it.
thanks -
How to use escape character in update statement.
Hi All,
I'm trying to update table using following sql update statement, but everytime it's asking me for the input due to the '&' value in below sql.
UPDATE xyz_xyz
SET NAME = 'ABC & PQR'
WHERE ID = (SELECT ID
FROM abc_abc
WHERE NAME = 'C & PQR');Please let me know how to use escape character syntax or let me know if there is any alternative solution.
Thanks,
VishwasHi,
By default, & marks a substitution variable name.
If you're not using substitution variables in that statement (or, if this is in PL/SQL, in that entire package or procedure) then the easiest thing to do is just diable substitution variables; then & will be a normal character:
SELECT DEFINE OFF
UPDATE xyz_xyz
SET NAME = 'ABC & PQR'
WHERE ID = (SELECT ID
FROM abc_abc
WHERE NAME = 'C & PQR');
SET DEFINE ONIf you can't do that, then & is always taken literally if it comes right before a single-quote, so you could say:
UPDATE xyz_xyz
SET NAME = 'ABC &' || ' PQR'
WHERE ID = (SELECT ID
FROM abc_abc
WHERE NAME = 'C &' || ' PQR');There is a SQL*Plus "SET ESCAPE" command, too, but if you use it, you have to worry about whether the escape character is to be taken literally or not.
SET ESCAPE \Yet another alternative is to make some other character, such as ~, mark the substitution variables:
SET DEFINE ~Read all about them in the SQL*Plus manual.
http://download.oracle.com/docs/cd/B28359_01/server.111/b31189/ch2.htm#sthref103 -
Hi all,
can you guys suggest me how can I use pl/sql tables for the below query to incresing the performance.
DECLARE
TYPE cur_typ IS REF CURSOR;
c cur_typ;
total_val varchar2(1000);
sql_stmt varchar2(1000);
freeform_name NUMBER;
freeform_id NUMBER;
imgname_rec EMC_FTW_PREVA.EMC_Image_C_Mungo%rowtype;
imgval_rec EMC_FTW_PREVA.EMC_Content_C_Mungo%rowtype;
CURSOR imgname_cur IS
select * from EMC_FTW_PREVA.EMC_Image_C_Mungo
where cs_ownerid in (
select id from EMC_FTW_PREVA.EMC_Image_C
where updateddate > '01-JUN-13'
and path is not null
and createddate != updateddate)
and cs_attrid = (select id from EMC_FTW_PREVA.EMC_ATTRIBUTE where name = 'Image_Upload');
BEGIN
OPEN imgname_cur;
LOOP
FETCH imgname_cur INTO imgname_rec;
EXIT WHEN imgname_cur%NOTFOUND;
total_val := 'EMC_Image_C_' || imgname_rec.cs_ownerid;
sql_stmt := 'SELECT instr(textvalue,''' || total_val || '''), cs_ownerid FROM EMC_FTW_PREVA.EMC_Content_C_Mungo a Where cs_attrid = (select id from EMC_FTW_PREVA.EMC_ATTRIBUTE where name = ' || '''' || 'Body_freeform' || '''' || ')';
OPEN c FOR sql_stmt;
LOOP
FETCH c INTO freeform_id,freeform_name;
EXIT WHEN c%NOTFOUND;
IF freeform_id > 0 THEN
dbms_output.put_line (imgname_rec.cs_ownerid || ',' || total_val || ',' || freeform_id || ',' || freeform_name);
END IF;
END LOOP;
CLOSE c;
END LOOP;
CLOSE imgname_cur;
END;
Thanks in Advance.can you guys suggest me how can I use pl/sql tables for the below query to incresing the performance.
There would be absolutely no point at all in improving the performance of code that has NO benefit.
The only result of executing that code is to possibly produce some lines of output AFTER the entire procedure if finished:
dbms_output.put_line (imgname_rec.cs_ownerid || ',' || total_val || ',' || freeform_id || ',' || freeform_name);
So first you need to explain:
1. what PROBLEM you are trying to solve?
2. why you are trying to use PL/SQL code to solve it.
3. why are you using 'slow by slow' (row by row) processing and then, for each row, opening a new cursor to query more data?
You should be using a single query rather than two nested cursors. But that begs the question of what the code is even supposed to be doing since the only output is going to a memory buffer. -
How to use count sql statement?
i've never used the count function and i'm not sure how to use it to print it onto a html page...my code is below...
<%
String tot = (String)session.getAttribute("total");
int total = Integer.parseInt(tot);
Class.forName("org.postgresql.Driver");
// create connection url
String URL2 = "jdbc:postgresql://dbhost/ug59sxn";
// pass database parameters to JDBC driver
Connection Conn2 = DriverManager.getConnection(URL2, "ug59sxn", "hupeswop");
// query statement
Statement SQLStatement2 = Conn2.createStatement();
// generate query
String Query2 = "SELECT COUNT(*) FROM userteam WHERE total > '"+total+"'";
// get result code
ResultSet SQLResult2 = SQLStatement2.executeQuery(Query2);
int position = (int)SQLResult2 + 1;
%>
<TD valign=top>
<P align=center><FONT size=+1>Welcome <%= session.getAttribute("fName") %> <%= session.getAttribute("surname") %><BR>
Your Team, <%= session.getAttribute("teamname") %>, are currently lying in position <FONT color=red><% out.println(position) %></font>, with <FONT color=red><%= session.getAttribute("total") %></font> points.<BR>
</FONT></P>
<P align=justify> Use the shorcuts on the left to visit different sections of the game.
You can change your squad around to prepare for forthcoming games (fixtures can be found in the statistics section),
transfer a player in to your squad to add some depth or replace injured members, or perhaps browse the statistics section to see how your team is doing in the FFL table.</P>
<HR>
<%
SQLResult2.close();
SQLStatement2.close();
Conn2.close();
%>
i get the following errors:
type Exception report
message Internal Server Error
description The server encountered an internal error (Internal Server Error) that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Unable to compile class for JSPNote: sun.tools.javac.Main has been deprecated.
An error occured between lines: 62 and 84 in the jsp file: /main2.jsp
Generated servlet error:
/home/students/ug/ug59sxn/servlets-local/work/localhost/myapp/main2$jsp.java:80: Invalid cast from java.sql.ResultSet to int.
int position = (int)SQLResult2 + 1;
^
An error occurred at line: 88 in the jsp file: /main2.jsp
Generated servlet error:
/home/students/ug/ug59sxn/servlets-local/work/localhost/myapp/main2$jsp.java:108: Invalid type expression.
out.println(position)
^
An error occurred at line: 88 in the jsp file: /main2.jsp
Generated servlet error:
/home/students/ug/ug59sxn/servlets-local/work/localhost/myapp/main2$jsp.java:111: Invalid declaration.
out.write("</font>, with <FONT color=red>");
^
3 errors, 1 warning
if anyone can help me out, please do so..thanx in advance...You cannot cast a ResultSet object (or any other object for that matter) to a primitive (such as an int)
Replace the following line of code:
int position = (int)SQLResult2 + 1;with this:
int position = 0;
if(SQLResult2.next())
position = SQLResult2.getInt(1) + 1;
}Additionally I noticed that you have put single quotes around total in the following line:
String Query2 = "SELECT COUNT(*) FROM userteam WHERE total > '"+total+"'";Are you sure that the total column in the userteam table is of string type? If not, you don't need the single quotes. -
How to use PL/SQL & Forms6i for a logon screen
i am new user to oracle. just wanna now how to create a user logon screen using SQL and Forms6i. well, i have created a table for logon with data item of username and password. in the form, i hava successfully created the data blocks but i don't know how to link them using PL/SQL or triggers or etc.
ur concern will be very grateful. TQ.Hi MatrixMan
Just create button and write the follwing inside
trigger when_button_pressed :\
begin
logout;
LOGON(:USER_NAME,:PASSWORD );
IF FORM_SUCCESS THEN
MESSAGE('Login Successful');
MESSAGE('Login Successful');
ELSE
MESSAGE('Check username or password');
MESSAGE('Check username or password');
GO_ITEM('USER_NAME');
:USER_NAME:=NULL;
:PASSWORD:=NULL;
END IF;
end;
Thanks
Mohammed Al-shake -
How to use Native SQL statement in JDBC receiver interface
Dear All,
Can any one please help us in using Native SQL statement in a JDBC receiver channel. The reason why I need to use Native SQL statement instead of standard XML structure is that I need to execute a dynamic SQL query in third party database system lke:-
Select Field1 Field2 from TABLE Where Field3 like "%Name'
I expect the the response in the form of XML file which I can pick up using synchornous interface as mentioned on help.sap.com:-
http://help.sap.com/saphelp_nw04/helpdata/en/64/ce4e886334ec4ea7c2712e11cc567c/frameset.htm
http://help.sap.com/saphelp_nw04/helpdata/en/64/ce4e886334ec4ea7c2712e11cc567c/frameset.htm
The value for %Name can change dynamically according to the transaction and hence cannot be inluded as a KEY element in standard XLM structure,
Hence I need to know:-
1. What message mapping I should use in case if I have to use Native SQL statement.
2.What operation mapping I should use in case if I have to use Native SQL statement.
If guess correclty I may have to use Java mapping to do the above activities. Hence I want to know
3 .How do to go about it to do the Java mapping.
Thanks
Ameet>
Ameet Deshpande wrote:
> Dear All,
>
> Can any one please help us in using Native SQL statement in a JDBC receiver channel. The reason why I need to use Native SQL statement instead of standard XML structure is that I need to execute a dynamic SQL query in third party database system lke:-
>
> "
> Select Field1 Field2 from TABLE Where Field3 like "%Name'
> "
> I expect the the response in the form of XML file which I can pick up using synchornous interface as mentioned on help.sap.com:-
>
> http://help.sap.com/saphelp_nw04/helpdata/en/64/ce4e886334ec4ea7c2712e11cc567c/frameset.htm
> http://help.sap.com/saphelp_nw04/helpdata/en/64/ce4e886334ec4ea7c2712e11cc567c/frameset.htm
>
> The value for %Name can change dynamically according to the transaction and hence cannot be inluded as a KEY element in standard XLM structure,
>
> Hence I need to know:-
>
> 1. What message mapping I should use in case if I have to use Native SQL statement.
> 2.What operation mapping I should use in case if I have to use Native SQL statement.
> If guess correclty I may have to use Java mapping to do the above activities. Hence I want to know
> 3 .How do to go about it to do the Java mapping.
>
> Thanks
> Ameet
You can use a stored procedure, and call it from jdbc receiver adapter.
I also solve this issue, with a DBLookup in message mapping. You can refer to my blog, and this usefull 3d:
http://simonlesflex.wordpress.com/2010/12/07/pi-oracle-dblookup/
/people/alessandro.guarneri/blog/2006/03/27/sap-xi-lookup-api-the-killer
/people/siva.maranani/blog/2005/08/23/lookup146s-in-xi-made-simpler -
How to use this sql query in oracle?
Hi all,
i am using one sql query that is
SELECT @ToDate = '2012-10-03 00:00:00.000'
select @BetweenDate = DATEADD(MM,-1,@ToDate)
select @FromDate = DATEADD(m,DATEDIFF(m,0,@BetweenDate),0)
SELECT @ToDate = DATEADD(month, ((YEAR(@BetweenDate) - 1900) * 12) + MONTH(@BetweenDate), -1)
so @todate value is = '2012-10-03 00:00:00.000'
so in @betweendate value will come 1 month before like '2012-09-03 00:00:00.000'
again in @fromdate value will come like that '2012-09-01 00:00:00.000' means first date of @betweendate
and again @todate value will come like that '2012-09-30 00:00:00.000' means last date of @betweendate
it's happening in sql and i have to use same logic in oracle also.
how to use it??
thanksdeclare
todate date:= to_date('2012-10-03 00:00:00','yyyy-mm-dd hh:mi:ss');
betwendate date := add_months(todate,-1);
for datediff / additions you can direct subtract/add two different date variables
like
datediff = betweendate -todate
dateadd := todate+1; -
How to use Pl/Sql function in Discoverer report
Hi Everybody,
Would you be able to provide a workflow/guidance how to use sql function in Discoverer right from creating the function using PLSQL Developer.
(I am new to Oracle environment... prev. worked as analyst with Microsoft Access... took PL/Sql class in school a few years ago)
We are using Discoverer Desktop.
a) Just emailed dba for permission to create pl/sql function.
b) Recently got Discoverer Administrator installed on my pc.
can you pls add to the list:
c)....
d)....
etc.?
tx for your help, sandraHi Kranthi,
Thx for your warm words....
The links you provided are great! Thx soooo much!
Thanks to you and the rest of forum members, am able to use what you've all taught me
with other Discoverer reports.... so i was able to do more on my own....
About a month ago, I got access to Discoverer Admin, and was able to paste SQL to create a custom folder.
Then i joined the custom folder to an existing baseline folder.
I have found that sometimes when I use calc within a calc when the calcs use analytic functions, that Discoverer
just displays null in the column. I thought that maybe instead I could create my own function as a work-around.
I wrote IT for permissions to create views, functions etc. Hopefully, they'll approve and can move toward learning
pl/sql functions for Discoverer.
tx again, sandra -
Hi all,
How do i use Native SQL String in the Reciver JDBC Adapter.
Do i need to change the message format could u suggest me some blogs on the same.
Also please can anyone let me knw if i can use this for stored procedure.hi aditya,
there shud be no format as such. for sql xml format there are specific structure. but for native sql there shudnt be any specific structure.
as pointed in sap documentaion:
Instead of an XML document format, a text is expected that represents any valid SQL statement.
When inserting a line into a table the corresponding document looks as follows:
INSERT INTO tableName (column-name1, column-name2, column-name3) VALUES(column-value1, column-value2, column-value3)
so jus make sure that u give a valid sql statement becoz if will be passed as it is to the database and try ur scenario.
regards,
latika. -
How to use Native SQL in Toplink
I am using toplink in my project, can you please some one help me how to create native sql using toplink.
I have seen EntityManager interface having method createNativeQuery, but how to create instance of EntityManagerimport javax.persistence.EntityManager;within class, place
protected EntityManager entityManager;of course make it public, private, whatever you need.
Then, in your method
entityManager.createNativeQuery(....);R. Grimes -
How to use @jws:sql call Stored Procedure from Workshop
Is there anyone know how to use @jws tag call Sybase stored procedure within
Workshop,
Thanks,Anurag,
Do you know is there any plan to add this feature in future release? and
when?
Thanks,
David
"Anurag Pareek" <[email protected]> wrote in message
news:[email protected]..
David,
In the current release, we do not support calling stored procedures from a
database control. You will have to write JDBC code in the JWS file to call
stored procedures.
Regards,
Anurag
Workshop Support
"David Yuan" <[email protected]> wrote in message
news:[email protected]..
Anurag,
I know how to use DB connection pool and create a db control with it. In
fact, we have created a Web Service with the db control using plain SQL
in
@jws:sql. However, my question here is how to use @jws tag in Weblogic
Workshop to create a Web Services based on Sybase stored procedure orany
Stored Proc not plain SQL.
Thanks,
David
"Anurag Pareek" <[email protected]> wrote in message
news:[email protected]..
David,
You can use a database control to obtain a connection from any JDBC
Connection Pool configured in the config.xml file. The JDBC Connectionpool
could be connecting to any database, the database control is
independent
of
that.
Regards,
Anurag
Workshop Support
"David Yuan" <[email protected]> wrote in message
news:[email protected]..
Is there anyone know how to use @jws tag call Sybase stored
procedure
within
Workshop,
Thanks,
Maybe you are looking for
-
Enhancement in IDOC_INPUT_ORDERS not saving changes after order creation
I have an enhancement at the beginning of the IDOC_INPUT_ORDERS function module used to create sales orders via EDI. In the enhancement, I take the data records and make some changes to some quantities and units of measure. After making these chang
-
Unable to load dynamic library oci8.so
Hello All, When I try to start lampp, I am getting the below error. PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/extensions/no-debug-non-zts-20090626/oci8.so' - libclntsh.so.10.1: cannot open shared object file: No such fil
-
i have tried connecting my windows 8 machine to my mountain lion active directory every way possible and i get an error message saying something like this "an active directory domain controller (AD DC) could not be contacted" i only really want to do
-
I just install Acrobat X pro for mac on iMac 10.6.5. Everything went smoothly with one exception. I wasn't able to add the Acrobat virtual printer that was there in other versions. Is it no longer available? If so how do I create the printer? Thank
-
Hello This is not a site related comment, but there was no place to submit a comment by email. I would like to say I have the ThinkPad x120e laptop and it is a great laptop, I have to say 2 things that could make it better: *It does not need 15 level