0

I have function named

Schema.func_date(date,varchar)

I wanna do like this(I am using below statement inside Store proc)

Execute 'Select *, ID as Main_Id, ' ||
 'schema.func_date(quote_literal('2020-02-20'),quote_literal('ST')), '||
 'from main_table'

I am getting Invalid operation error while passing single quote string. How to pass the single quote string perfectly in execute statement?

asked Feb 23, 2021 at 19:49

1 Answer 1

1

While the QUOTE_LITERAL() function is helpful in specific contexts, I think you still need to manually escape the single quotes when you use Dynamic SQL.

So your query should follow this:

Execute 'Select *, ID as Main_Id, ' ||
 'schema.func_date(quote_literal(''2020-02-20''),quote_literal(''ST'')), '||
 'from main_table'
answered Feb 23, 2021 at 23:21

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.