Right syntax [message #318722] |
Wed, 07 May 2008 14:26  |
apps_user
Messages: 35 Registered: May 2008
|
Member |
|
|
I am storing select statement in a variable and using execute_immediate to execute that.
When I have only 'VP' in the following decode statement it didnot compile.
Once I put the ''VP'' in decode it compiled.
Is the syntaxt ok?
Here is the code I am calling:
'decode(d.DEPT_NAME,||''VP''||,d.DEPT_NAME,NULL) COMPANY,'||
Thanks in advance.
|
|
|
|
Re: Right syntax [message #318725 is a reply to message #318722] |
Wed, 07 May 2008 15:06   |
apps_user
Messages: 35 Registered: May 2008
|
Member |
|
|
Michel
VP is a value in dept_name field.
The psuedologic is if the value of DEPT_NAME is 'VP' then display else it should show up null in the report.
It should be this if I run from the sqlplus.
select
decode(d.DEPT_NAME,'VP',d.DEPT_NAME,NULL)
Please advise.
|
|
|
|
|
|
Re: Right syntax [message #318772 is a reply to message #318722] |
Wed, 07 May 2008 23:05   |
apps_user
Messages: 35 Registered: May 2008
|
Member |
|
|
Michel
Quote: |
In second case, remove the ||
|
This is not required as i am using like the following:
'decode(d.DEPT_NAME,||''VP''||,d.DEPT_NAME,NULL) COMPANY,'||
'e.emp_name '||
|
|
|
|
|
|
|
Re: Right syntax [message #318943 is a reply to message #318908] |
Thu, 08 May 2008 08:39  |
 |
Michel Cadot
Messages: 68761 Registered: March 2007 Location: Saint-Maur, France, https...
|
Senior Member Account Moderator |
|
|
Littlefoot wrote on Thu, 08 May 2008 14:32 | elaiyavel wrote on Thu, 08 May 2008 11:48 | Always use CHR(39) as a substitue to single quote (') while using excute immediate statements.
- Elaiyavel
|
Why? What's wrong with single quotes?
|
It does not know how to handle them.
Regards
Michel
|
|
|