Tuesday, December 05, 2006

In praise of Monty Python

If you like Monty Python's sense of humour, you'll easily catch some famous quotes i deliberately scattered throughout this posting.

Today i am not here to register a complaint.

I just want to write down a couple of frequently used (and frequently forgotten...) tricks so that i know where to find them the next time i need them.

Number one is the 10g useful feature for delimiting long literal strings:

instead of the annoying double tick mark escaping technique that can easily become a mess when you have large and intricated strings:

sql := 'select ''this is a string'' from dual';

in 10g you can write:

sql := q'!select 'this is a string' from dual!';

No more escaping!
Please note the norwegian blue i used to highlight the relevant text.

Note that you can use any other character of your choosing in place of "!", should it conflict with the string content.
And here is the relevant oracle document snippet for the skeptical visitor.

I don't know about you, but i always manage to forget where the starting and ending exclamation points go and i can't figure it out without resorting to the manual.


And now for something completely different.


Perform a submit when clicking on a checkbox in Oracle Application Express.

Suppose you have an item defined as a checkbox, tipically some sort of flag that allows you to show some extra information when it's true or the standard stuff when it's false, and you want to automatically reload the page when the user clicks on it.

Open its definition and locate the attribute named HTML Form Element Attributes.
Put the following stuff in it:

onChange="javascript:doSubmit('RELOAD');"

be sure to have defined a branch handling either a RELOAD request or an unconditional branch, otherwise you'll get a run time error.

EDITED on 25/5/2007
It turns out that with Internet Explorer 7.0 there is a little problem with onChange.
Read more about it.


Nudge, nudge, wink, wink, say no more!

That's all for today.

No comments:

yes you can!

Two great ways to help us out with a minimal effort. Click on the Google Plus +1 button above or...
We appreciate your support!

latest articles