How to replace and "&" character in PLSQL when working with XML content manipulation
- Rumesh Aponso (RMAX)

- Nov 7, 2024
- 1 min read
Updated: Nov 22, 2024
Declare a variable
and_char_ CHAR(1) := CHR(38);Use it
example: replace '&company' with 'NVL(company_, '%')'
quick_rep_sql_stmt_ := REPLACE(quick_rep_sql_stmt_, CHR(38) || 'company', NVL(company_, '%'));Example:
declare
and_char_ CHAR(1) := CHR(38);
quick_rep_sql_stmt_ VARCHAR2(200) := 'SELECT * FROM customer_order_tab WHERE contract = &contract';
begin
Dbms_Output.Put_Line('original stmt: ' || quick_rep_sql_stmt_);
quick_rep_sql_stmt_ := REPLACE(quick_rep_sql_stmt_, CHR(38) || 'contract', 'NVL(contract_, ''%'')');
Dbms_Output.Put_Line('modified stmt: ' || quick_rep_sql_stmt_);
end;




Comments