cancel
Showing results for 
Search instead for 
Did you mean: 

dynamic input to select data from jdbc

Former Member
0 Kudos

hi gurus,

i am doing JDBC toFile scenario.

in that is there anyway to give query dynamically.

i mean , i am having a field called orderid, i hava to select a record from the table based on the orderid.

i have given the static query in the adapter configuration and its working.

now i have to give the orderid dynamically. is there any possibility.

help me.

thanks in advance.

Indira D

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi

You can use place holders

Check the following help doc

http://help.sap.com/saphelp_nw04/helpdata/en/2e/96fd3f2d14e869e10000000a155106/content.htm

regards

krishna

Answers (3)

Answers (3)

Former Member
0 Kudos

hello,

Hope this is useful...

inside the Query SQL Statement you can use SQL EXECUTE

which can execute a stored procedure

in which you can do

SELECT * FROM myTable WHERE myDate = <current_date>

http://help.sap.com/saphelp_nw04/helpdata/en/7e/5df96381ec72468a00815dd80f8b63/content.htm

And Check this ...

http://help.sap.com/saphelp_nw04/helpdata/en/2e/96fd3f2d14e869e10000000a155106/content.htm

With Regards,

Raju.

Former Member
0 Kudos

hi,

the placeholders suggested works for receiver communication channel

(for sender side)

has anyone tried this. i am not sure if this works...

select * from table where datefield = getdate()

getdate() is the function in SQL which retrieves the current date

former_member192892
Active Contributor
0 Kudos

The problem wid getdate() is that in the column it'll check for the exact date i.e. time n all

So try usin select * from tableName where datepart(dd,getdate()) = datepart(dd,dateColumn) and datepart(mm,getdate()) = datepart(mm, dateColumn) and datepart(yyyy,getdate()) = datepart(yyyy, dateColum)

Former Member
0 Kudos

i hope this works but haven't tried this. has anyone tried this with a sender JDBC Adapter

justin_santhanam
Active Contributor
0 Kudos

Indira,

Can u give an example of how u want the SQL query dynamically...

Best regards,

raj.

Former Member
0 Kudos

you can also invoke a stored procedure via the

jdbc sender adapter (in which you can have select based

on date, time or other dynamic values)

Thanks 2 Michal

Regards

krishna

Former Member
0 Kudos

Hi Krishna !!

How can I use the JDBC Sender to use a select based on date ??!? How do I write it??

Thanks.

Matias.

Former Member
0 Kudos

Matias.... To select the records by date your table must have a column for storing the date updated...you can then use the current date (most databases support have current date as a db constant) as a filtering condition... Which DB are u using and is the table structure??