-
Select Statement Prob
Hi all
Can i give a select statement like below
I have one variable "FF" in which the value will be changed
First it will be
trunc(so_wr_dt,'MM')
trunc(so_wr_dt,'W')
trunc(so_wr_dt,'Q')
as i want to constuct the Query based on the user input
So now i want give the query as following
Select
Empno
&FF
From
Emp
Group by &FF;
Is it possible to give like that pass the variable value to the select statement.
If that is not the case i have to give the following three statement...as user wants the separate report
Select
Empno
trunc(so_wr_dt,'MM')
From
Emp
Group by
trunc(so_wr_dt,'MM');
Select
Empno
trunc(so_wr_dt,'W')
From
Emp
Group by
trunc(so_wr_dt,'w');
Select
Empno
trunc(so_wr_dt,'Q')
From
Emp
Group by
trunc(so_wr_dt,'Q');
Let me know the possible ways for this Question.
Thanks
-
If you are using Oracle then you can do that. If it is MS SQL, then you can create a stored procedure with an input variable, construct a sql string and execute using EXEC command.
-
S u r correct , we can do that, i tried to pass the veriable in a .sql file, but it is not taking , so can u help me with some test code , so that i can test that also...
-
Use && instead of just &. Using && does not prompt for the same variable multiple times.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|