Friday, 15 April 2011

oracle - Searching first condition first and only if not available then second condition -


I am writing a SQL query where the query should first search the first value, and only if this value is missing from the query Search for another value.

I have two tables, one of these tables is the date of amendment (it is not always full and it can be null ) and a creation date which always gets filled up

Now what I need is that the query first appears in the table along with the date of the revision and only when it is zero , the table appears with the date of creation .

Example of the query:

  Choose from all_ articles * where to_char (amended_date, 'yYYYMMDD') = to_char (sysdate, 'YYYYMMDD') - 1 - If this blank record Is  

Can anyone help me with this question?

Almost all major RDBMSs are available to handle such a situation are the functions Oracle DB has the NVL function which works as follows: NVL (Modified_dt, created_dt);

The above modified DTD column data will be returned by default. However, if it is not available, then it will return Create_dt

for details see here:


No comments:

Post a Comment