Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing a Section of a Select Statement to Dynamic

Status
Not open for further replies.

getjbb

MIS
Jun 4, 2003
139
US
The snippet of code I have a question about is below:

if state_id = 'AL' or is_state_id = 'CA' then
Select taxes, fees
Into :ld_pst_taxes, :ld_gst_fees
From state_charges p, state_charges g
Where upper(p.fee) ='JSS' and upper
(g.fee) ='MSS'
and p.fee_parm = :a_fee_parm
***********************************************
and p.state_id = :is_state and g.state_id = :is_state
************************************************
and p.corp_id = (select corp_id
from branch_lookup
where branch_id = somevariable)
and g.corp_id = (select corp_id
from branch_lookup
where branch_id = somevariable)
end if

I want to know if it is possible to make the section I have
surrounded by asterisk dynamic without making the whole select statement dynamic.

I need to use dynamic sql here, because state_id is unknown until run time. The variable, is_state, will either be 'AL' or 'CA'.

getjbb
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top