Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

add single quote to input parameter

user650888May 5 2017 — edited May 8 2017

CREATE OR REPLACE PROCEDURE P_TEST(P_F IN VARCHAR2)

IS

V_T VARCHAR2(10);

BEGIN

V_T := p_f;

DBMS_OUTPUT.PUT_LINE('V_T: '||V_T);

END;

what i am trying to do is if someone calls the above procedure with value 'Y' (value would be Y), I want to add a single quote to the input parameter,

so if you call the above proc with 'Y', (value is Y), i want to add a single quote to it so the value would be 'Y')

BEGIN

P_TEST(P_F=> 'Y');

END;

/

Trying regexp_replace but not able to do it;

select regexp_replace('Y',*,'''Y''') FROM DUAL

Even a simple replace i am not able to get the 'Y'

SELECT REPLACE('Y','''''Y''''') FROM DUAL

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 5 2017
Added on May 5 2017
6 comments
3,043 views