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!

How to access column type and Column Values of a Row type Variable and Replace

User_H40KVJan 13 2020 — edited Jan 13 2020

Hello Guru's,

Table Name  : EMPLOYEE

lv_emp_rowtype EMPLOYEE%ROWTYPE;

Fun1 ()

{

Set each variable of the lv_emp_rowtype    with different Values depend on the Business logics

Call Function2 (lv_emp_rowtype)

}

Function2(lv_emp_rowtype EMPLOYEE%ROWTYPE)

{

lv_SQL :=  'Insert into Employee_Interface_Table (Col1 , col2,...) Values (||lv_emp_rowtype.col1 , lv_emp_rowtype.co2 ....)';

EXECUTE IMMEDIATE lv_SQL ;

}

As above the Values are getting concatenated and pushed to interface Table for Processing.

Help Required :

Some of the character fields contains "single Quotes" . So required to search each column of the row type Variable something like below and replace

one single Quote with two single quotes , So during concatenation , it should create any issue.

Abc'def    =>   Abc''def

example of Query required :

select  * from lv_emp_rowtype_columns where  column_data_type  = 'VARCHAR2' and column_value like '%'%';

Replace '%'%' with '

Appreciate your help.

Thanks

Comments
Post Details
Added on Jan 13 2020
1 comment
572 views