473,386 Members | 1,698 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

way to solve

ilikesuresh
Hi i have the table called table_days
based on the case result i need to select either d0 or d1

i have written this query to do it
But this will give missing expression error
Plz give me a way to accomplish my task

select name,
case when (trunc(sysdate) - trunc(update_date) = 2)
then
select d0 from table_days
end
from table_days
Sep 5 '07 #1
4 1323
Hi i have the table called table_days
based on the case result i need to select either d0 or d1

i have written this query to do it
But this will give missing expression error
Plz give me a way to accomplish my task

select name,
case when (trunc(sysdate) - trunc(update_date) = 2)
then
select d0 from table_days
end
from table_days
Hi friend
pls correct query

select
case when trunc(sysdate) - trunc(update_date) = 2 then (SELECT 'd0' FROM TABLE_DAYS) ELSE '1'end
from table_days;
Sep 5 '07 #2
amitpatel66
2,367 Expert 2GB
Hi friend
pls correct query

select
case when trunc(sysdate) - trunc(update_date) = 2 then (SELECT 'd0' FROM TABLE_DAYS) ELSE '1'end
from table_days;

The above Query would return 'd0' as a value and not column value. And it is not mandatory to write SELECT for each CASE statement in case if the column that is returned is from same table itself. You can directly say the column name itself as shown below:

Expand|Select|Wrap|Line Numbers
  1. SELECT
  2. CASE WHEN Empno = 112 THEN ename
  3. ELSE
  4. TO_CHAR(empno) END
  5. from emp
  6.  
Note: ELSE clause is Optional
Sep 5 '07 #3
Hi friend
pls correct query

select
case when trunc(sysdate) - trunc(update_date) = 2 then (SELECT 'd0' FROM TABLE_DAYS) ELSE '1'end
from table_days;
Thanks buddy.
but this d0 is a column name in the table_days
Sep 5 '07 #4
amitpatel66
2,367 Expert 2GB
Thanks buddy.
but this d0 is a column name in the table_days
Do post back in case of any further issues!!
Sep 5 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Oracle3001 | last post by:
Hi All, I am looking to use SVD to solve an equation of the form Aa = B, where a is 1 row x 11 col A is 2 rows x 11 col B is 2 rows x 1 col I know from the information I am reading I need...
3
by: Knoppix User | last post by:
Hi folks I still have not been able to solve this one, which didn't manage to garner a response yesterday, so I'm rephrasing it here. If I define an attribute in the __init__ statement of a...
17
by: Just | last post by:
While googling for a non-linear equation solver, I found Math::Polynomial::Solve in CPAN. It seems a great little module, except it's not Python... I'm especially looking for its poly_root()...
1
by: BVM | last post by:
Hi, All: I have this error. It seems execution time is too long. Actually the execution time is about 30 seconds(I tested in Query analyzer). How do I solve this problem? ...
3
by: Alex | last post by:
Hi, I have a problem involving some design issue. I have two unrelated (that is, they do not derive from the same base) classes: ClassA ClassB Both have a quite similar interface, so they can...
27
by: Alf P. Steinbach | last post by:
I'm writing a little piece on pointers, to be "bundled" with my attempted correct C++ tutorial (see FAQ item 29.20, yes, I've finally started to at least think about that again), and while thinking...
1
by: Koen | last post by:
Hi all, I created a little database to manage my e-books. The program will synchronize a table with the contents of a directory. Works great. Because I keep additional info (like keywords) to...
8
by: vj | last post by:
Hi all, I want to solve the two equations u*tan(u)=w and u^2 + w^2=V^2, where V is a known constant, and u and w are the two unknowns to be determined. Please can someone suggest me how to...
1
by: arun | last post by:
Query is too complex -------------------------------------------------------------------------------- Hi, I was trying to solve this problem since last two days but couldn't find any solution. ...
7
by: akmaRudiliyn | last post by:
Hai everybody :). I have problem and need help. ERROR: ERROR Violation of PRIMARY KEY constraint 'PK_Table1_01'. Cannot insert duplicate key in object 'dbo.table1'. ERROR The statement has...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.