Home » Developer & Programmer » Forms » problem with global value while inserting from calling form (forms 6i,oracle 9.2.0.1,winxp)
icon10.gif  problem with global value while inserting from calling form [message #333996] Tue, 15 July 2008 02:45 Go to next message
seyed456
Messages: 220
Registered: May 2008
Location: south india .
Senior Member

hello all,

im using global variable to get the username in global.abc .
but when im try to use that global.abc from another form it does nt work.
can u advise me how to overcome this problem ??

login form
when button pressed trigger

DECLARE
   v_count   NUMBER;
   a         NUMBER;
BEGIN
   SELECT COUNT (*)
     INTO v_count
     FROM login
    WHERE username = :login.username AND passwrd = :login.passwrd;

   IF v_count = 1
   THEN
      :GLOBAL.abc := :login.username;
      CALL_FORM ('enrollment');
   ELSE
      a := SHOW_ALERT ('ALERT_INVALID');
   END IF;
EXCEPTION
   WHEN OTHERS
   THEN
      a := SHOW_ALERT ('ALERT_LOGIN_ERROR');
END;




enrollment form
when button pressed trigger



DECLARE
    v_status char(1) := 'N';
    v_courseid number;
    a number;
      
 BEGIN
      
   IF :exam_date IS NULL
   THEN
      MESSAGE ('enter the Exam date');
  
   ELSIF :course IS NULL
   THEN
      MESSAGE ('select the coursename');
   ELSIF :exam_paper IS NULL
   THEN
      MESSAGE ('select the exam paper');
   END IF;
 
 
   SELECT course_id
     INTO v_courseid
     FROM online_course
     WHERE course = :block3.course
     AND exam_paper = :block3.exam_paper;

if :exam_date > sysdate then
   INSERT INTO onlin_enroll(exam_id, user_name, course_id, exam_date,enrollment_date, status)
   VALUES(exa_id_seq.nextval, :global.abc, v_courseid, :exam_date,sysdate, v_status);
   message(:global.abc);
   COMMIT;
else
 a:= show_alert('alert_exam');
 end if;  
   exception
    when others then
  
   a:=show_alert('alert_error'); 
END;



thanks in advance






Re: problem with global value while inserting from calling form [message #334007 is a reply to message #333996] Tue, 15 July 2008 03:24 Go to previous messageGo to next message
Littlefoot
Messages: 20901
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Quote:
it does nt work.
Meaning ... what, exactly?

Did you check value of :global.abc in the first form, before calling the second form?
Did you search the second form for all appearances of this global variable (because, perhaps it is erased somewhere before using it in the WHEN-BUTTON-PRESSED trigger)?
Re: problem with global value while inserting from calling form [message #334012 is a reply to message #333996] Tue, 15 July 2008 03:32 Go to previous messageGo to next message
seyed456
Messages: 220
Registered: May 2008
Location: south india .
Senior Member

thanks little foot..

im getting the value in global.abc (global variable)...
but dnt know y its not working enrollment form ??

[Updated on: Tue, 15 July 2008 03:34]

Report message to a moderator

Re: problem with global value while inserting from calling form [message #334013 is a reply to message #333996] Tue, 15 July 2008 03:32 Go to previous messageGo to next message
azamkhan
Messages: 548
Registered: August 2005
Senior Member
The Global variable can service for a session only. Which means if you want a GLOBAL variable to live you should create it in a session.

I would suggest you to first check are you create a GLOABLE variable after create a session. And if you are create it after creating a session then check that during the switching from one FORM to another FORM are you re-loging or not.

I have dont this and it is working fine.
Re: problem with global value while inserting from calling form [message #334015 is a reply to message #333996] Tue, 15 July 2008 03:41 Go to previous messageGo to next message
seyed456
Messages: 220
Registered: May 2008
Location: south india .
Senior Member

hello azam khan.thanks for your response..

i created a global variable in login form .
after signing into the login form its moving to the enrollment form by using call form..
im not doing relogging.






Re: problem with global value while inserting from calling form [message #334016 is a reply to message #333996] Tue, 15 July 2008 03:44 Go to previous messageGo to next message
seyed456
Messages: 220
Registered: May 2008
Location: south india .
Senior Member

im getting an error (frm-40815 variable :global.abc does not exist) when im trying to return using message.
Re: problem with global value while inserting from calling form [message #334021 is a reply to message #333996] Tue, 15 July 2008 03:51 Go to previous message
seyed456
Messages: 220
Registered: May 2008
Location: south india .
Senior Member

i did compile all .. .
its working fine now. .
thanks alot to all/. .
Previous Topic: ora 01403
Next Topic: REP-3301:Error occurred in Error Checking(RXGLER)
Goto Forum:
  


Current Time: Fri Dec 09 12:02:48 CST 2016

Total time taken to generate the page: 0.06194 seconds