Skip to content

Instantly share code, notes, and snippets.

@alexanderjsingleton
Last active May 5, 2016 14:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexanderjsingleton/a07c965dc00706e3a6da6311f8ade6ce to your computer and use it in GitHub Desktop.
Save alexanderjsingleton/a07c965dc00706e3a6da6311f8ade6ce to your computer and use it in GitHub Desktop.
How to avoid whitespace with RegEx when concatenating multiple-columns in Oracle PL/SQL (REGEXP_REPLACE)
CONNECT ap/ap;
SET SERVEROUTPUT ON
declare
min_invoice_total ap.invoices.invoice_total%TYPE;
max_invoice_total ap.invoices.invoice_total%TYPE;
begin
SELECT MIN(invoice_total), MAX(invoice_total) INTO min_invoice_total,max_invoice_total
FROM ap.invoices;
DBMS_OUTPUT.put_line(REGEXP_REPLACE('The minimum invoice total is' || to_char(min_invoice_total, '$999,999.00') || ' while the maximum output total is ' || to_char(max_invoice_total, '$999,999.00') || '.', ' +', ' '));
end;
@alexanderjsingleton
Copy link
Author

alexanderjsingleton commented May 4, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment