This content has been marked as final. Show 2 replies
user10664276 wrote:You have the right idea. You have 2 left "(" characters, but only 1 right ")". I think you meant:
i would like to dispaly account number from bank account name if bank account num is null.
SELECT NVL ( bank_account_num , SUBSTR (bank_account_name, 6) ) AS account_num FROM ap_checks_all
HDFC_0000000000000SUBSTR (bank_account_name, 6) will be from the 6th character to the end of the string. If you want everything after the "_", wherever that happens to be, then use:
i need to display 00000000000 from both the bank name.
SELECT NVL ( bank_account_num , SUBSTR ( bank_account_name , 1 + INSTR (bank_account_name, '_') ) ) AS account_num FROM ap_checks_all
I hope this answers your question.
If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only), and also post the results you want from that data.
Explain, using specific examples, how you get those results from that data.
Always say which version of Oracle you're using.