Ask the Expert

Using PL/SQL to read delimited ASCII text files... Part 5

Continued from Part 4...

    Requires Free Membership to View

-- *********************
-- **  u n q u o t e  **
-- *********************

--  unquote returns a copy of in_text with all doubled 
--  occurrences of in_quote_text changed to single occurrences.
--  If in_text starts with quote_text, the starting quote is
--  removed first, and an equal length (assumed to be a closing
--  quote, but not checked that it is) is removed from the end.

FUNCTION unquote
  in_text         IN      VARCHAR2,
  in_quote_text   IN      VARCHAR2
  quote_len PLS_INTEGER := LENGTH (in_quote_text);
  return_text VARCHAR2 (32767) := in_text;
  IF  in_quote_text IS NOT NULL
    IF  INSTR (in_text, in_quote_text) = 1
      return_text := SUBSTR ( in_text,
                              1 + quote_len,
                              LENGTH (in_text) - (2 * quote_len)
    END IF;

    return_text := REPLACE ( return_text,
                             in_quote_text || in_quote_text,

  RETURN  return_text;
END unquote;

-- ******************************
-- **  Initialization Section  **
-- ******************************

 unclaimed_text := '';
END pk_csv;

GRANT  EXECUTE  ON csv.pk_csv  TO csv_admin;

This was first published in July 2003

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: