In Oracle, single quotes have two effects, one is that strings are quoted by single quotes , and the other is escaped. The use of single quotes is the nearest pairing, the nearest principle . While single quotation marks are relatively poorly understood when they act as escape characters
1, starting from the second single quotation mark is considered an escape character, if there is a single quotation mark after the second single quotation mark (even if there is only one).
Select ' from dual----output: '
Explanation: The second single quotation mark is used as an escape character, and the third single quote is escaped, which can be written in such a way as to better understand:
Select ' from dual----output: '
2. Connector ' | | ' resulting in a new round of escaping: Connection symbol ' | | ' There is no relationship between the single quotation marks, except ' | | ' is part of a string (this is common in dynamic SQL).
Select ' Name ' | | ' from dual----output:name '
Understand: | | The following as a string, that is, before and after is ', in the middle is a dense single quote string ', so the first escape function
Select ' Name ' from dual----output:name '
Understanding: First and last single quotation marks as String reference, middle four single quotes 22 escape
Example:
Select ' Insert into Wt_shipmentproduct (wt_shipmentproduct_id, ad_client_id, ad_org_id, ISACTIVE, CREATED, CreatedBy, UPDATED, Updatedby, m_product_id, wt_owms_shipment_id, wt_ofc_id, QTY, Confirmqty, NAME) ' | |
' VALUES (Wt_shipmentproduct_seq.nextval, one, 50000, ' Y ', Sysdate, 1000180, Sysdate, 1002382, (select m_product_id from M _product p WHERE P.sku = "' | |
M.sku | |
"), (select wt_owms_shipment_id from wt_owms_shipment s where S.documentno =" ' | |
M.documentno | |
"), (select wt_ofc_id from wt_owms_shipment where documentno=" | |
M.documentno | | "), ' | | m.qtyproduct | | ', 0, ' ' | | M.name | |
‘‘‘);‘
,
M.qtyproduct
From Adempiere.wv_owms_arrivalnoticeproduct m
where M.documentno in (' 1000768 ')