From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,XPRIO autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,cfdcc4473552f01f,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-10-25 01:05:32 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!news.tele.dk!news.tele.dk!small.news.tele.dk!news.teledanmark.no!uninett.no!uio.no!newsfeed.song.fi!nntp.inet.fi!central.inet.fi!inet.fi!read2.inet.fi.POSTED!not-for-mail From: "Anders Wirzenius" Newsgroups: comp.lang.ada Subject: GNATCOM Exception X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-Mimeole: Produced By Microsoft MimeOLE V5.50.4522.1200 Message-ID: Date: Fri, 25 Oct 2002 08:05:29 GMT NNTP-Posting-Host: 194.251.142.2 X-Trace: read2.inet.fi 1035533129 194.251.142.2 (Fri, 25 Oct 2002 11:05:29 EET DST) NNTP-Posting-Date: Fri, 25 Oct 2002 11:05:29 EET DST Organization: Sonera corp Internet services Xref: archiver1.google.com comp.lang.ada:30123 Date: 2002-10-25T08:05:29+00:00 List-Id: I have a peculiar GNATCOM behaviour when I try to use the function Execute on an Oracle database I get an exception with message "Bad variable type" when executing the following statements: declare SQL_Update_User_Data : Constant GWindows.GString := To_GString_From_String ( "UPDATE EMPLOYEE " & "SET " & "EMP_ACCDOM_ID='" & This_ACCDOM & "', " & "EMP_MAIL='" & This_Mail & "', " & "EMP_UPDATE_BY=" & User_ID & ", " & "EMP_UPDATE_DATE=TO_DATE('" & HD.User.Today & "','dd.MM.YYYY') " & "WHERE EMP_ID = " & This_Row & " " & "AND TO_CHAR(emp_timestmp,'dd.mm.yyyy hh24:Mi:ss') = '" & Time_Stamp & "'" ); begin Rows_Updated := Execute(DB_Control.Database, SQL_Update_User_Data); The database record is updated, but I get the error message. I manage to avoid the exception if I display a message box prior to the Execute: Message_Box ("Update this record", "Update this record", Icon => Information_Icon); Rows_Updated := ... How can I get rid of the error message in another way? Anders Below the code of the whole procedure: -- -- Update the current record from bindings -- procedure Update_Employee ( Window : in out GWindows.Base.Base_Window_Type'Class ) is This_Row : Constant String := Field_Value (DB_Control.Recordset, "EMP_ID"); Time_Stamp : Constant String := Field_Value (DB_Control.Recordset, "TIMESTMP"); Last_Name : Constant String := Text(Last_Name_Start); This_ACCDOM : Constant String := Text(EMP_ACCDOM_ID); This_Mail : Constant String := Text(EMP_MAIL); User : Constant String := HD.User.Get_User_Name; User_ID : Constant String := HD.User.Get_User_Empp_ID(User); Rows_Updated: Natural := 0; SQL_Update_User_Data : Constant GWindows.GString := To_GString_From_String ( "UPDATE EMPLOYEE " & "SET " & "EMP_ACCDOM_ID='" & This_ACCDOM & "', " & "EMP_MAIL='" & This_Mail & "', " & "EMP_UPDATE_BY=" & User_ID & ", " & "EMP_UPDATE_DATE=TO_DATE('" & HD.User.Today & "','dd.MM.YYYY') " & "WHERE EMP_ID = " & This_Row & " " & "AND TO_CHAR(emp_timestmp,'dd.mm.yyyy hh24:Mi:ss') = '" & Time_Stamp & "'" ); begin -- Message_Box ("Update this record", -- "Update this record", -- Icon => Information_Icon); -- -- Make an attempt to update the record. -- Rows_Updated := Execute(DB_Control.Database, SQL_Update_User_Data); -- Message_Box ("Update attempted", -- "An attempt to update the row was made", -- Icon => Information_Icon); Requery_This_Record(Window, This_Row); -- -- Ask user to redo if a concurrent update was made for the record. -- The Time_Stamp must be unchanged since entering this procedure. -- if Rows_Updated = 0 then Message_Box ("Update Failed", "A concurrent update was made in the database, please redo your update.", Icon => Information_Icon); Set_Selection(Last_Name_Start,1,Last_Name'Length); Replace_Selection(Last_Name_Start,Text(EMP_LAST_NAME)); Requery_This_Record(Window, This_Row); end if; exception when others => Message_Box ("Error", To_GString_From_String (GNATCOM.IErrorInfo.Get_IErrorInfo), Icon => Error_Icon); Requery_This_Record(Window, This_Row); end Update_Employee;