Just stumbled over a blog post from Steven Feuerstein. He talks about not using DBMS_OUTPUT in our code directly but through a package that allows to turn it on/off and but the output in a table or as indented with DBMS_OUTPUT on screen. You may find Steven’s article here.
Category Archives: PL/SQL
Reply
Toad & SQL Developer – copying data including column headers in data grid
If you want to copy the column header in the data grid then do the folloing
in Toad:
1. select the data you want to copy
2. press CTRL+INSERT
in SQL Developer
1. select the data you want to copy
2. press CTRL+SHIFT+INSERT
This works with parts of the columns too.
Literals: Alternative to single quote to start/end a string
As all know I can use single quotes to start/end a string in SQL and PL/SQL.
SELECT 'my string' AS a FROM dual; A --------- my string
When we have single quotes in a string we need an escape character. In Oracle this is another single quote. That looks like this.
SELECT 'my string with two single quotes for one '' ' AS a FROM dual; A ------------------------------------------- my string with two single quotes for one '
Complex strings can be difficult to handle this way. But Oracle provides another option.
SELECT q'[my string]' AS a FROM dual; A --------- my string
This way you can have as many single quotes in the string as you wish.
There are other options besides [] – {}, ().
SELECT q'{my 1' 2'' 3''' 4'''' string}' AS a
FROM dual;
A
---------------------------
my 1' 2'' 3''' 4'''' string
I hope this helps.