Run string as SQL statement [message #295164] |
Mon, 21 January 2008 09:44  |
amardilo
Messages: 37 Registered: February 2007
|
Member |
|
|
Hi there,
I have a stored procedure that I need to allow users to pass in select statements into. I need those select statements to output a cursor.
Is there a way to do this?
Some users have little SQL skills so I will need to fix up the statement (i.e. some people won't put the word SELECT at the start), this I can fix but is there anyway I can execute a select statement as a string and return it as a CURSOR from a stored procedure?
|
|
|
|
|
Re: Run string as SQL statement [message #295186 is a reply to message #295164] |
Mon, 21 January 2008 11:37   |
amardilo
Messages: 37 Registered: February 2007
|
Member |
|
|
Sorry to double post but I have another question what happens if I need to do a search on a string/VARCHAR2
i.e. how do I turn this into a VARCHAR2
vMyString := 'SELECT * FROM my_table WHERE column_name LIKE '%col%' AND field = 'abc' OR field2 = ' || myString2 || ';'
This string uses several ' in there would that cause an issue? do I need to write in a different character (or is there cleaver override for this)?
[Updated on: Mon, 21 January 2008 11:53] Report message to a moderator
|
|
|
|
|
|
|
|
|