Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

How to display default value if sql not return any row.

Vemula MuniSep 13 2019 — edited Sep 20 2019

Hi All,

Below is my query. In that i will pass the emplid and comparison date dynamically.

For that emplid and date combination, if project id is present then i need to fetch that project id. if project id is not present then i need to display some default value.

  1. When query returns project id i want to exclude the default value, if query not return any row then i need to get some default value.

Note : Query may return one or more projectid for one employee.

SELECT B.PROJECT_ID FROM PS_CTSRM_ASGNSR_VW B , PS_RS_ASSGN_DETAIL C WHERE B.ASSIGNMENT_ID = C.ASSIGNMENT_ID AND

B.EMPLID = '155114'

AND B.ASSIGN_STS IN ('A','C') AND TO_DATE('2019-08-01','YYYY-MM-DD') BETWEEN C.START_DT AND C.END_DT

In below example my query returns value,so no need the default value in this case.

pastedImage_0.png

in below example query not return any row , so i want to display some default value.

pastedImage_1.png

This post has been answered by L. Fernigrini on Sep 13 2019
Jump to Answer

Comments

lmu

Are you restoring it to the same place or to a different server? 

EdStevens

How is this different from your other thread?

We can't tell anything based on a list of file names and an irrelevant listing of the spfile.  But if I had to guess, based on those file names, that's not even an rman backup, in spite of your assertion otherwise.

You should continue to work your previous thread.

L. Fernigrini

Please close this thread and continue on the original one. Explain there exactly what are you trying to do...

Mark D Powell

JP, you should always identify the full version of Oracle in use.  Are you using a backup tool, which in turn actually performs the rman backups? If you are using a tool it should also handle the restore otherwise the Backup manuals are under Administration in the online database documentation

- -

https://docs.oracle.com/en/database/oracle/oracle-database/index.html

- -

If you are restoring the same database the backup is for on the same server it was made on then the rman restore can be as simple as

restore database

recover database

- -

The restore depends on the details which you did not post.

- -

HTH -- Mark D Powell --

SITI

Resolved

Mike Kutz

SITI wrote:

Resolved

Please post the solution then flag it as "correct answer"

If you don't want to do that, flag the "Resolved" post as "correct answer".

If you don't want to do that, please flag the post as "Assumed answered"

If you don't want to do that, please bare in mind that we really appreciate closed threads and dislike people who have a bad habit of not closing them.

thanks,

MK

SITI

We got the EXPDP(Datapump) backup from the customer.

Thanks,

Sunny kichloo

If it is resolved do close this thread.

Thanks

EdStevens

SITI wrote:

We got the EXPDP(Datapump) backup from the customer.

Thanks,

Which has nothing to do with rman . . .

SITI

There were no option to close this Thread.

Please assist.

EdStevens

SITI wrote:

There were no option to close this Thread.

Please assist.

You are correct.  There is no literal 'close' function.  You 'close' a thread by marking an answer as 'correct'.  If you discovered the answer yourself, post it and mark your own posting as 'correct'.

1 - 11

Post Details

Added on Sep 13 2019
3 comments
8,403 views