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!

column starts with forward slash and causes problem in plsql

VSN MoorOct 28 2021

I have a view as below and one of the columns starts with forward slash.
create or replace view test_1 as
select
100 aufsd,
'test' "/1LT/PROCESSED"
from dual;
----Below is the select statement. We need to give double quotes to get the column value as below:
select aufsd,"/1LT/PROCESSED" from test_1;
I am taking the columns of the above view in a dynamic sql and displaying as an example.
I assign the values to variables that are created within procedure to assign the column values.
Below is the sample plsql procedure:
create or replace procedure test_string as
cursor col_cur is
select
aufsd,
"/1LT/PROCESSED"
from test_1;
l_aufsd varchar2(100);
l_/1LT/PROCESSED varchar2(100);
BEGIN
dbms_output.put_line('Started');
for data_rec in data_cur
loop
l_aufsd:= data_rec.aufsd;
l_/1LT/PROCESSED := data_rec./1LT/PROCESSED;
dbms_output.put_line(l_aufsd);
dbms_output.put_line(l_/1LT/PROCESSED);
end loop;
dbms_output.put_line('Ended');
END;
/
sho errors;

need help how to handle in plsql if there is a field that starts with forward slash. This kind of fields are common in our database. We can't use some other field name instead of the field with forward slash
Thanks and Regards,

This post has been answered by Frank Kulash on Oct 28 2021
Jump to Answer
Comments
Post Details
Added on Oct 28 2021
6 comments
3,358 views