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!

use of insert in case

874449Aug 24 2011 — edited Aug 25 2011
Hi,
Is it possible to use insert statement in CASE.

For example as follows:

let create a table as

create table DECOMPENSATED_BALANCE_TMP (ENDING_ENTERED_BALANCE_DR number, ENDING_ENTERED_BALANCE_CR number);

select
CASE
WHEN (PERIOD_NET_DR+BEGIN_BALANCE_DR-PERIOD_NET_CR-BEGIN_BALANCE_CR) total > 0
THEN
INSERT INTO XXGL_DECOMPENSATED_BALANCE_TMP (ENDING_ENTERED_BALANCE_DR) values (total)
WHEN (PERIOD_NET_DR+BEGIN_BALANCE_DR-PERIOD_NET_CR-BEGIN_BALANCE_CR) <= 0
THEN
INSERT INTO XXGL_DECOMPENSATED_BALANCE_TMP (ENDING_ENTERED_BALANCE_CR) values (total)
else
NULL
end
from gl_balances
where code_combination_id=109940 and currency_code='GBP';

Any answers will be highly appreciated ....

Thanks,
zaheer
This post has been answered by 884055 on Aug 24 2011
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 22 2011
Added on Aug 24 2011
5 comments
5,567 views