Home » Developer & Programmer » Forms » Single Record Works. All Not Workss. (6i)
Single Record Works. All Not Workss. [message #583814] Sat, 04 May 2013 10:53 Go to next message
shahzad-ul-hasan
Messages: 617
Registered: August 2002
Senior Member
Respected
i am facing the problem. please see the attached file.the comp_code record on right side is working fine everytime i changed the comp_code. but when i press button send to all it gives me error.
..........Frm-40735...........Ora-01422

When Button press code:..........
DECLARE
B VARCHAR2(30);
A VARCHAR2(30);
BEGIN
SELECT DISTINCT COMPUTER_CODE INTO B FROM FEE WHERE STATAS='present';
SELECT DISTINCT MOBILE INTO A FROM FEE3
WHERE FEE3.COMPUTER_CODE=B;
IF :MSGALL = 'Yes' Then
Loop
INSERT INTO MSGOUT (IID,MSGTO,MSG)
VALUES
(B,A,:MSSG);
COMMIT;
NEXT_ITEM;
EXIT;
END LOOP;
ELSE
NEXT_ITEM;
END IF;
END;

please help me to remove ambeguity.

  • Attachment: 1.JPG
    (Size: 25.64KB, Downloaded 720 times)
Re: Single Record Works. All Not Workss. [message #583817 is a reply to message #583814] Sat, 04 May 2013 11:22 Go to previous messageGo to next message
Littlefoot
Messages: 21813
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Too many rows, eh? There's nothing much WE can do about it - it is YOU who has to sort it out. One (or both?) of SELECT statements returns more than a single record. Find out which one (either by running it in SQL*Plus or by placing MESSAGE built-ins around these SELECTs) and fix it. How? You'll probably have to include additional WHERE condition(s). Apparently, DISTINCT you used wasn't enough.
Re: Single Record Works. All Not Workss. [message #583819 is a reply to message #583817] Sat, 04 May 2013 21:47 Go to previous messageGo to next message
shahzad-ul-hasan
Messages: 617
Registered: August 2002
Senior Member
SIR
i have made some adjustment in the code.please review it is correct.
------------------------------------------------------------
DECLARE
B VARCHAR2(30);
A VARCHAR2(30);

CURSOR CC IS
SELECT DISTINCT COMPUTER_CODE,MOBILE FROM FEE3
WHERE FEE3.COMPUTER_CODE IN (SELECT DISTINCT COMPUTER_CODE FROM FEE WHERE STATAS='present');
BEGIN
OPEN CC;
LOOP
FETCH CC
INTO A,B;
:A:= A; :B:= B;
IF :MSGALL = 'Yes' AND :COM_CODE IS NULL Then
INSERT INTO MSGOUT (IID,MSGTO,MSG)
VALUES
(A,B,:MSSG);
COMMIT;
END IF;

EXIT WHEN CC%NOTFOUND;
END LOOP;
NEXT_RECORD;
CLOSE CC;
END;
its works what i want from this function but pls see the attached file.it shows me the dialouge box which i want not to be shown.
----------------------------------------
  • Attachment: 2.JPG
    (Size: 34.08KB, Downloaded 707 times)

[Updated on: Sat, 04 May 2013 23:23]

Report message to a moderator

Re: Single Record Works. All Not Workss. [message #583824 is a reply to message #583819] Sun, 05 May 2013 04:24 Go to previous messageGo to next message
cookiemonster
Messages: 13925
Registered: September 2008
Location: Rainy Manchester
Senior Member
shahzad-ul-hasan wrote on Sun, 05 May 2013 03:47
SIR
i have made some adjustment in the code.please review it is correct.

We know nothing about your tables, or their data, or how they are related to each other.
Also we have no idea what your code is supposed to do.
So how could we possibly know if your current code is correct?

I will say that you should read up on cursor for loops, and that proper programmers always give variables meaningful names instead of a and b.


shahzad-ul-hasan wrote on Sun, 05 May 2013 03:47

its works what i want from this function but pls see the attached file.it shows me the dialouge box which i want not to be shown.

You can change system.message_level to hide that.
Re: Single Record Works. All Not Workss. [message #583834 is a reply to message #583824] Sun, 05 May 2013 08:28 Go to previous message
Littlefoot
Messages: 21813
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
(Before posting your next message, please, spare 10 seconds of your time and have a look at How to use [code] tags and make your code easier to read?. Learn how to properly indent & format your code, as well as keep that formatting when you post it on the OraFAQ (as well as any other) forum).
Previous Topic: Delete Records [merged 3]
Next Topic: How can i use some fields of the form in arabic
Goto Forum:
  


Current Time: Tue Jul 02 21:56:22 CDT 2024