I am attempting to insert an ' into a string and can't seem to get
the results I want. Here are the details:
v_script := 'select tablespace_name from user_segments
where segment_name = ' || v_tbl || ';';
this results in:
select tablespace_name from user_segments
where segment_name = ITEM;
If I try:
v_script := 'select tablespace_name from user_segments
where segment_name = ' || ''' v_tbl ''' || ';';
this results in:
select tablespace_name from user_segments
where segment_name = ' v_tbl ';
The first example evaluates the variable but no apostrophes, the
second example gets apostrophes but does not evaluate the variable.
The result I need is:
select tablespace_name from user_segments
where segment_name = 'ITEM';