Home » Developer & Programmer » Forms » see my code and error
see my code and error [message #173356] |
Mon, 22 May 2006 01:39 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
mfa786
Messages: 210 Registered: February 2006 Location: karachi
|
Senior Member |
|
|
hi master
sir i put this code in when-button-press
but system give me error
this is my code
declare
curryear number;
begin
select yearid into curryear from yeartable where closingstatus='T';
if curryera >0 then
delete opbaltable where yearid=curryear+1;
insert into opbaltable (chofacc,dropbal,cropbal,yearid)
(select chart_of_account.chofacc,
case when
nvl(open_debit+sum(journal.debit),0) >nvl(open_credit+sum(journal.credit),0)
then
nvl(open_debit+sum(journal.debit),0) -nvl(open_credit+sum(journal.credit),0)
end drbal,
case when
nvl(open_debit+sum(journal.debit),0) <nvl(open_credit+sum(journal.credit),0)
then
nvl(open_credit+sum(journal.credit),0) - nvl(open_debit+sum(journal.debit),0)
end crbal,curryear
from chart_of_account,journal where chart_of_account.chofacc=journal.chofacc group by chart_of_account.chofacc,open_debit,open_credit having nvl(open_debit+sum(journal.debit),0)>0 or nvl(open_credit+sum(journal.credit),0)>0);
else if
commit;
end;
this is my error
Error 103 at line 55, column 1
Encountered the symbol “CASE” when expecting one of the following :
(- + mod null <an identitier>
please give me idea how i use this
thank you
aamir
|
|
|
Re: see my code and error [message #173359 is a reply to message #173356] |
Mon, 22 May 2006 01:52 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
![](/forum/images/custom_avatars/72104.gif) |
Littlefoot
Messages: 21823 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
If you change
"IF curryera > 0" into "if currYEAR > 0"
and
"else if" into "end if;"
this would compile; I don't know will the procedure do what it is intended to do.DECLARE
curryear NUMBER;
BEGIN
SELECT yearid
INTO curryear
FROM yeartable
WHERE closingstatus = 'T';
IF curryear > 0
THEN
DELETE opbaltable
WHERE yearid = curryear + 1;
INSERT INTO opbaltable
(chofacc, dropbal, cropbal, yearid)
(SELECT chart_of_account.chofacc,
CASE
WHEN NVL (open_debit + SUM (journal.debit), 0) >
NVL (open_credit + SUM (journal.credit),
0)
THEN NVL (open_debit + SUM (journal.debit),
0
)
- NVL (open_credit + SUM (journal.credit), 0)
END drbal,
CASE
WHEN NVL (open_debit + SUM (journal.debit), 0) <
NVL (open_credit + SUM (journal.credit),
0)
THEN NVL (open_credit + SUM (journal.credit),
0
)
- NVL (open_debit + SUM (journal.debit), 0)
END crbal,
curryear
FROM chart_of_account, journal
WHERE chart_of_account.chofacc = journal.chofacc
GROUP BY chart_of_account.chofacc, open_debit, open_credit
HAVING NVL (open_debit + SUM (journal.debit), 0) > 0
OR NVL (open_credit + SUM (journal.credit), 0) > 0);
END IF;
COMMIT;
END;
|
|
|
give me error on case word [message #173365 is a reply to message #173359] |
Mon, 22 May 2006 02:21 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
mfa786
Messages: 210 Registered: February 2006 Location: karachi
|
Senior Member |
|
|
sir
i put this code
but give me error on case word
DECLARE
curryear NUMBER;
BEGIN
SELECT yearid
INTO curryear
FROM yeartable
WHERE closingstatus = 'T';
IF curryear > 0
THEN
DELETE opbaltable
WHERE yearid = curryear + 1;
INSERT INTO opbaltable
(chofacc, dropbal, cropbal, yearid)
(SELECT chart_of_account.chofacc,
?? error point <<<< CASE >>>>>
WHEN NVL (open_debit + SUM (journal.debit), 0) >
NVL (open_credit + SUM (journal.credit),
0)
THEN NVL (open_debit + SUM (journal.debit),
0
)
- NVL (open_credit + SUM (journal.credit), 0)
END drbal,
CASE
WHEN NVL (open_debit + SUM (journal.debit), 0) <
NVL (open_credit + SUM (journal.credit),
0)
THEN NVL (open_credit + SUM (journal.credit),
0
)
- NVL (open_debit + SUM (journal.debit), 0)
END crbal,
curryear
FROM chart_of_account, journal
WHERE chart_of_account.chofacc = journal.chofacc
GROUP BY chart_of_account.chofacc, open_debit, open_credit
HAVING NVL (open_debit + SUM (journal.debit), 0) > 0
OR NVL (open_credit + SUM (journal.credit), 0) > 0);
END IF;
COMMIT;
END;
|
|
|
|
Goto Forum:
Current Time: Sat Feb 08 12:39:16 CST 2025
|