I am working in an ORACLE package. I have a procedure that displays options for a user to select. The option is a simple drop down (select) list. I am using the OWA_UTIL.LISTPRINT function. I am trying to include a variable in the "WHERE" clause of the query, but I keep getting the "variable not recognized" error or the "Encountered the symbol '$%^' " symbol. I know its soemthing simple. Just a matter of syntax but I haven't figured it out. Code is below:
htp.bodyOpen ;
htp.centeropen;
htp.formopen (curl => twbkwbis.f_cgibin || 'sykcrrp.p_display_report',
cmethod => 'POST');
htp.tableopen;
htp.br;
htp.tableRowOpen;
htp.tableData ( 'Select Class Year: ',
cattributes => 'style="text-align:right;"' );
twbkfrmt.P_TableDataOpen ( cattributes => 'style="text-align:left;"' );
OWA_UTIL.LISTPRINT ( p_theQuery => 'SELECT distinct class_description, class_code||'' - ''||class_description, null'
||' FROM ROSTER_TABLE'
||' WHERE EXISTS (SELECT ''x'''
||' FROM ROLE_TABLE'
||' WHERE Role_pidm = ||'v_id'||'''
||' AND Role_role = ''ROSTER_''||program)'
||' order by 1',
p_cname => 'p_class_year',
p_nsize => 7,
p_multiple => TRUE );
twbkfrmt.P_TableDataClose;
htp.tableRowClose;
htp.tableClose;
htp.bodyClose;
htp.br;
htp.htmlclose;
EXCEPTION
WHEN OTHERS THEN
htp.print(SQLERRM);
END;
In my code, my variable is v_id. I am passing this in. I know there is a value in there as I am able to output it to the screen as a number. Again, it looks like a syntax issue that I just haven't figured out yet. Having trouble concatenating it or using the apostrophes, or idk.
Any help on this would be great. Thanks in advance.