Author |
Message
|
yogi |
Posted: Thu May 26, 2011 1:45 am Post subject: Updating database with Broker conneting Java as Front End |
|
|
 Apprentice
Joined: 13 Dec 2010 Posts: 35 Location: Pune, India
|
Code which I have written :
Code: |
IF FieldType(inRef.fis:ZoneTime) IS NOT NULL THEN
SET outRef.cs:GridColumnName = 'ZoneDateTime';
-- TODO: Find out what the gridcolumnname is for the attribute.
SET outRef.cs:NewValue VALUE = CAST(CAST(inRef.fis:ZoneTime AS GMTTIMESTAMP FORMAT 'I') AS CHAR FORMAT 'ddMMyyyykkmm');
ELSEIF FieldType(inRef.fis:FinalsTime) IS NOT NULL THEN
SET outRef.cs:GridColumnName = 'FinalsDateTime';
SET outRef.cs:NewValue VALUE = CAST(CAST(inRef.fis:FinalsTime AS GMTTIMESTAMP FORMAT 'I') AS CHAR FORMAT 'ddMMyyyykkmm');
ELSEIF FieldType(inRef.fis.FUEL_REQ_STATUS) IS NOT NULL THEN
SET outRef.cs.GridColumnName = 'FuelReqStatus';
SET outRef.cs.NewValue VALUE = CAST(CAST(inRef.fis.FUEL_REQ_STATUS AS GMTTIMESTAMP FORMAT 'I') AS CHAR FORMAT 'ddMMyyyykkmm');
ELSEIF FieldType(inRef.fis.FUEL_REQUIREMENT) IS NOT NULL THEN
SET outRef.cs:GridColumnName = 'FuelReq';
SET outRef.cs.NewValue VALUE = CAST(CAST(inRef.fis.FUEL_REQUIREMENT AS GMTTIMESTAMP FORMAT 'I') AS CHAR FORMAT 'ddMMyyyykkmm'); |
For the above code database is updating the first two (ZoneTime, Finals Time) values while we are doing manually but, below two (FUEL_REQ_STATUS, FUEL_REQUIREMENT) fields are not updating. Zone and Finals come under Time column where as FuelReq and FuelReqStaus come under Flight column. Is there any code changes please reply ASAP.
 _________________ YoGi |
|
Back to top |
|
 |
fjb_saper |
Posted: Thu May 26, 2011 2:25 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Maybe you should have used
IF ---- THEN --- END IF constructs instead of
IF ---- THEN ----ELSEIF constructs...?
Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
Vitor |
Posted: Thu May 26, 2011 4:40 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
fjb_saper wrote: |
Maybe you should have used
IF ---- THEN --- END IF constructs instead of
IF ---- THEN ----ELSEIF constructs...? |
ELSEIF - urgh!  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
yogi |
Posted: Sun May 29, 2011 10:12 pm Post subject: |
|
|
 Apprentice
Joined: 13 Dec 2010 Posts: 35 Location: Pune, India
|
Quote: |
IF FieldType(inRef.fis:ZoneTime) IS NOT NULL THEN
SET outRef.cs:GridColumnName = 'ZoneDateTime';
-- TODO: Find out what the gridcolumnname is for the attribute.
SET outRef.cs:NewValue VALUE = CAST(CAST(inRef.fis:ZoneTime AS GMTTIMESTAMP FORMAT 'I') AS CHAR FORMAT 'ddMMyyyykkmm');
ELSEIF FieldType(inRef.fis:FinalsTime) IS NOT NULL THEN
SET outRef.cs:GridColumnName = 'FinalsDateTime';
SET outRef.cs:NewValue VALUE = CAST(CAST(inRef.fis:FinalsTime AS GMTTIMESTAMP FORMAT 'I') AS CHAR FORMAT 'ddMMyyyykkmm');
ELSEIF FieldType(inRef.fis:ActTouchDown) IS NOT NULL THEN
SET outRef.cs:GridColumnName = 'LandedDateTime';
SET outRef.cs:NewValue VALUE = CAST(CAST(inRef.fis:ActTouchDown AS GMTTIMESTAMP FORMAT 'I') AS CHAR FORMAT 'ddMMyyyykkmm');
ELSEIF FieldType(inRef.fis:ActAirborne) IS NOT NULL THEN
SET outRef.cs:GridColumnName = 'AirborneDateTime';
SET outRef.cs:NewValue VALUE = CAST(CAST(inRef.fis:ActAirborne AS GMTTIMESTAMP FORMAT 'I') AS CHAR FORMAT 'ddMMyyyykkmm');
ELSEIF FieldType(inRef.fis:AirportOnBlockTime) IS NOT NULL THEN
SET outRef.cs:GridColumnName = 'ChksOnDateTime';
SET outRef.cs:NewValue VALUE = CAST(CAST(inRef.fis:AirportOnBlockTime AS GMTTIMESTAMP FORMAT 'I') AS CHAR FORMAT 'ddMMyyyykkmm');
ELSEIF FieldType(inRef.fis:AirportOffBlockTime) IS NOT NULL THEN
SET outRef.cs:GridColumnName = 'ChocksOffDateTime';
SET outRef.cs:NewValue VALUE = CAST(CAST(inRef.fis:AirportOffBlockTime AS GMTTIMESTAMP FORMAT 'I') AS CHAR FORMAT 'ddMMyyyykkmm');
ELSEIF FieldType(inRef.fis:FuelReq) IS NOT NULL THEN
SET outRef.cs:GridColumnName = 'FuelReq';
SET outRef.cs:NewValue VALUE = CAST(CAST(inRef.fis:FuelReq AS GMTTIMESTAMP FORMAT 'I') AS CHAR FORMAT 'ddMMyyyykkmm');
ELSEIF FieldType(inRef.fis:FuelReqStatus) IS NOT NULL THEN
SET outRef.cs:GridColumnName = 'FuelReqStatus';
SET outRef.cs:NewValue VALUE = CAST(CAST(inRef.fis:FuelReqStatus AS GMTTIMESTAMP FORMAT 'I') AS CHAR FORMAT 'ddMMyyyykkmm');
ELSEIF FieldType(inRef.fis:FreightWeight) IS NOT NULL THEN
SET outRef.cs:GridColumnName = 'FreightWeight';
SET outRef.cs:NewValue VALUE = CAST(CAST(inRef.fis:FreightWeight AS GMTTIMESTAMP FORMAT 'I') AS CHAR FORMAT 'ddMMyyyyykkmm');
ELSEIF FieldType(inRef.fis:MailWeight) IS NOT NULL THEN
SET outRef.cs:GridColumnName = 'MailWeight';
SET outRef.cs:NewValue VALUE = CAST(CAST(inRef.fis:MailWeight AS GMTTIMESTAMP FORMAT 'I') AS CHAR FORMAT 'ddMMyyyykkmm');
ELSEIF FieldType(inRef.fis:VIP_Flag) IS NOT NULL THEN
SET outRef.cs:GridColumnName = 'VIP_Flag';
SET outRef.cs:NewValue VALUE = CAST(CAST(inRef.fis:VIP_Flag AS GMTTIMESTAMP FORMAT 'I') AS CHAR FORMAT 'ddMMyyyykkmm');
ELSEIF FieldType(inRef.fis:Priority_Flag) IS NOT NULL THEN
SET outRef.cs:GridColumnName = 'Priority_Flag';
SET outRef.cs:NewValue VALUE = CAST(CAST(inRef.fis:Priority_Flag AS GMTTIMESTAMP FORMAT 'I') AS CHAR FORMAT 'ddMMyyyykkmm');
ELSEIF FieldType(inRef.fis:RevisedETA) IS NOT NULL THEN
SET outRef.cs:GridColumnName = 'RevisedETA';
SET outRef.cs:NewValue VALUE = CAST(CAST(inRef.fis:RevisedETA AS GMTTIMESTAMP FORMAT 'I') AS CHAR FORMAT 'ddMMyyyykkmm');
ELSEIF FieldType(inRef.fis:RevisedETD) IS NOT NULL THEN
SET outRef.cs:GridColumnName = 'RevisedETD';
SET outRef.cs:NewValue VALUE = CAST(CAST(inRef.fis:RevisedETD AS GMTTIMESTAMP FORMAT 'I') AS CHAR FORMAT 'ddMMyyyykkmm');
ELSEIF FieldType(inRef.fis:GateStatus) IS NOT NULL THEN
SET outRef.cs:GridColumnName = 'GateStatus';
SET outRef.cs:NewValue VALUE = CAST(CAST(inRef.fis:GateStatus AS GMTTIMESTAMP FORMAT 'I') AS CHAR FORMAT 'ddMMyyyykkmm');
ELSEIF FieldType(inRef.fis:NrTouchdown) IS NOT NULL THEN
SET outRef.cs:GridColumnName = 'NrTouchdown';
SET outRef.cs:NewValue VALUE = CAST(CAST(inRef.fis:NrTouchdown AS GMTTIMESTAMP FORMAT 'I') AS CHAR FORMAT 'ddMMyyyykkmm');
ELSEIF FieldType(inRef.fis:NrApproaches) IS NOT NULL THEN
SET outRef.cs:GridColumnName = 'NrApproaches';
SET outRef.cs:NewValue VALUE = CAST(CAST(inRef.fis:NrApproaches AS GMTTIMESTAMP FORMAT 'I') AS CHAR FORMAT 'ddMMyyyykkmm');
ELSEIF FieldType(inRef.fis:EstimatedOnBlockTime) IS NOT NULL THEN
SET outRef.cs:GridColumnName = 'EstimatedOnBlockTime';
SET outRef.cs:NewValue VALUE = CAST(CAST(inRef.fis:EstimatedOnBlockTime AS GMTTIMESTAMP FORMAT 'I') AS CHAR FORMAT 'ddMMyyyykkmm');
ELSEIF FieldType(inRef.fis:EstimatedOffBlockTime) IS NOT NULL THEN
SET outRef.cs:GridColumnName = 'EstimatedOffBlockTime';
SET outRef.cs:NewValue VALUE = CAST(CAST(inRef.fis:EstimatedOffBlockTime AS GMTTIMESTAMP FORMAT 'I') AS CHAR FORMAT 'ddMMyyyykkmm');
END IF; |
whole code used in IF--THEN--ELSEIF, in the above code 1st 6 fields are updating correctly after that nothing is updating. _________________ YoGi |
|
Back to top |
|
 |
fjb_saper |
Posted: Mon May 30, 2011 3:09 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
As each fieldtype is referencing a different field I do not see the point of using ELSEIF.
I would have used a list of IF --- ELSE -- END IF and repeated it for each field you are checking.
Think hard about the logical implications of using ELSEIF in this particular scenario...
In any case, instead of repeating the code I would have created a routine and called it for each field...
Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
yogi |
Posted: Tue May 31, 2011 9:39 pm Post subject: |
|
|
 Apprentice
Joined: 13 Dec 2010 Posts: 35 Location: Pune, India
|
Quote: |
As each fieldtype is referencing a different field I do not see the point of using ELSEIF.
I would have used a list of IF --- ELSE -- END IF and repeated it for each field you are checking.
Think hard about the logical implications of using ELSEIF in this particular scenario...
In any case, instead of repeating the code I would have created a routine and called it for each field... |
I am not getting you. can you explain in brief ?? _________________ YoGi |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Jun 01, 2011 2:23 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
yogi wrote: |
Quote: |
As each fieldtype is referencing a different field I do not see the point of using ELSEIF.
I would have used a list of IF --- ELSE -- END IF and repeated it for each field you are checking.
Think hard about the logical implications of using ELSEIF in this particular scenario...
In any case, instead of repeating the code I would have created a routine and called it for each field... |
I am not getting you. can you explain in brief ?? |
We're saying, change your code to use IF *only* and not ELSEIF.
You are running into issues because one of your conditions is being satisfied in such a way that it doesn't try any of the other conditions.
And you have written code that says that only ONE Of your conditions should be met, instead of writing code that says that ALL of your conditions COULD be met. |
|
Back to top |
|
 |
yogi |
Posted: Wed Jun 01, 2011 9:58 pm Post subject: |
|
|
 Apprentice
Joined: 13 Dec 2010 Posts: 35 Location: Pune, India
|
Quote: |
And you have written code that says that only ONE Of your conditions should be met, instead of writing code that says that ALL of your conditions COULD be met. |
It has to be in the way which I have written, here problem is different. When I am deploying every field is executing except "FuelReq" and "FuelReqStatus".
Error which I was getting : ORA-01747: invalid user.table.column, table.column, or column specification
I have reloaded the execution group then deployed next time I got error : You do not have the privilege to carry out this action. _________________ YoGi |
|
Back to top |
|
 |
rekarm01 |
Posted: Thu Jun 02, 2011 12:32 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 1415
|
yogi wrote: |
Error which I was getting : ORA-01747: invalid user.table.column, table.column, or column specification |
It might have been useful to post that a week ago.
Is this error occurring within the posted code, or within unposted code? |
|
Back to top |
|
 |
|