Focal Point
How to pass parameter to SQL?

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/1961067331

November 10, 2003, 11:19 AM
<iamvijay>
How to pass parameter to SQL?
Hi,
i've written this code in a procedure (i didn't create report),
actually i want to give a date condition based on user data, based on that conditional result, i need to create report. can anybody help in this?
(i want where condition in this select statement)

SQL
Select Ename, Job, HireDate, Sal, Comm From Emp;
END

thanq

vijay

Confused
November 10, 2003, 02:33 PM
<Satish Paladugu>
Vijay,
Different databases have different date formats. Here is the example for Oracle.

Select Ename, Job, HireDate, Sal, Comm From Emp where HireDate = '01-OCT-2003';

Does this answer your question?

Thanks and Regards
Satish Paladugu
November 11, 2003, 02:14 AM
<iamvijay>
Hi Satish,
Thanq very much for ur reply,

I know this, but i wanted to check for the date entered by the user, something like this

Select Ename, Job, HireDate, Sal, Comm From Emp where HireDate = '&UserDate';

And i wanted to use this result in a different report, can u plz help me out, i'm totally confused,

thanx n regards

vijay
November 11, 2003, 05:45 PM
<Vijay Kodali>
Vijay,

You can directly write a SQL query in your fex file and you can hold/save the output from that query in a holdfile. You can use some thing like this if you are using ORACLE:

SQL SQLORA SET SERVER servername

SQL SQLORA

Select Ename, Job, HireDate, Sal, Comm From Emp where HireDate = '&UserDate';

TABLE
ON TABLE HOLD AS holdfile
END

TABLE FILE holdfile
PRINT Ename Job HireDate Sal Comm
END

I hope this work for you!

Thanks,
Vijay
November 12, 2003, 04:11 AM
<iamvijay>
Thanx for the reply,

Select statement is working properly, but if i give where condition, like,

SELECT EMPNO, ENAME, HIREDATE, JOB FROM EMP WHERE HIREDATE = '&USERDATE';

it is not prompting for the parameter value and even if i open it in resource layout, it's not showing any textbox object.

can u plz. tell me what i've to do?

vijay

Confused