Home » Developer & Programmer » Forms » DEFAULT_WHERE Decode statement
DEFAULT_WHERE Decode statement [message #302686] Tue, 26 February 2008 10:58 Go to next message
GHott
Messages: 8
Registered: August 2007
Junior Member
Are you able to use DECODE or CASE statements within a DEFAULT_WHERE on a block?

I've tried a few variations and it doesn't seem to like what I'm doing.

If DECODE and CASE statements can not be used, is their an equivalent substitution available?
Re: DEFAULT_WHERE Decode statement [message #302742 is a reply to message #302686] Tue, 26 February 2008 19:26 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Can you write the code you wish to use at the SQL*Plus prompt?

David

Upd: I typed PL/SQL, I meant SQL*Plus.

[Updated on: Tue, 26 February 2008 19:27]

Report message to a moderator

Re: DEFAULT_WHERE Decode statement [message #303015 is a reply to message #302686] Wed, 27 February 2008 10:38 Go to previous messageGo to next message
GHott
Messages: 8
Registered: August 2007
Junior Member
Yes, it will execute successfully within SQL+ when setup for a short dummy run.

However, when I try to execute a:

SET_BLOCK_PROPERTY(BLOCK,DEFAULT_WHERE,'DECODE(IF PARAMETER, IS THIS, THEN DO THIS, ELSE DO THIS)');

It gives me two unable to perform query and two missing right parenthesis errors.

The two DO THIS areas of the decodes are within single quotes, and they are performing long SQL commands...several SELECT THIS MINUS SELECT THIS WHERE....etc. Those queries work perfectly within the DEFAULT_WHERE block without the DECODE statement.
Re: DEFAULT_WHERE Decode statement [message #303150 is a reply to message #302686] Thu, 28 February 2008 03:07 Go to previous messageGo to next message
Flash
Messages: 34
Registered: February 2008
Member
Decode will work in a default where.

Dude, you have tried wrong options. Please understand the usage of DECODE.

DECODE ( col_name, if_this, then_this, else_this ) is fine for a select.
But when you are using it in a where clause you need to give
DECODE ( col_name, if_this, then_this, else_this ) = This_value

Consider emp table from Scott

My query goes like this
SELECT empno, ename, job, mgr, sal, comm, deptno FROM emp WHERE DECODE(JOB,'SALESMAN','A') = 'A'

And my default_where would look like this.
DECODE(JOB,'SALESMAN','A') = 'A'

This will display all Salesmen when you query the form !!
Please find the attached file.
Re: DEFAULT_WHERE Decode statement [message #303208 is a reply to message #302686] Thu, 28 February 2008 07:05 Go to previous message
GHott
Messages: 8
Registered: August 2007
Junior Member
Thanks for your help!
Previous Topic: Programmitcally Hide List Item
Next Topic: how to make a picture button in oracle forms?
Goto Forum:
  


Current Time: Fri Sep 27 10:29:53 CDT 2024