Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> How to include a '%' in a PL/SQL script?
What's the correct syntax to include a percentage sign
in a PL/SQL script like the one below?
In sqlplus the line would be something like this:
SQL> SELECT parent_id FROM family WHERE company_id like '%1234';
Thanks,
-Ramon F. Herrera
CREATE OR REPLACE PROCEDURE fullid IS
BEGIN
DECLARE
CURSOR traverse IS SELECT claim_id, company_id FROM hearing;
identify VARCHAR2(512);
parentID VARCHAR2(512);
BEGIN FOR tab IN traverse LOOP
identify := 'SELECT parent_id FROM family WHERE company_id like ''%:here'''; EXECUTE IMMEDIATE identify INTO parentID USING tab.company_id; DBMS_OUTPUT.PUT_LINE('Child ' || tab.company_id || ' Parent ' || parentID);
END LOOP; END; END fullid; Received on Wed Mar 31 2004 - 00:45:18 CST