Link to home
Start Free TrialLog in
Avatar of pc_melsa
pc_melsa

asked on

Append data into Interbase Table

Dear Experts, please help !
Create Table Temperature ( Name Char(10), Temp_Array SmallInt  [24,366] )

This table is intended to hold 'hourly temperatures for twenty cities for a year', but I
couldn't  append data into Temp_Array column, please give me detail solution.

Thanks from apin.
Avatar of Igor UL7AAjr
Igor UL7AAjr
Flag of Kazakhstan image

Hi pc_melsa.

Do you realy need to manipulate with array of SmallInt in Interbase procedures or triggers? If it's not, then more easy to declare blob field and keep there normal Delphi array.

When you declare field as array[xx,yy], you will need to do something like this:

EXEC SQL
BEGIN DECLARE SECTION;
BASED ON TEMPERATURE.TEMP_ARRAY Temp_Array;
EXEC SQL
END DECLARE SECTION;

....do somethig with array....

EXEC SQL
INSERT INTO TEMPERATURE (NAME,TEMP_ARRAY)
VALUES ("some_name", :Temp_Array);

EXEC SQL
COMMIT;
Avatar of pc_melsa
pc_melsa

ASKER

Dear Mr. ITugay,
    Thanks for your sugestion, if the blob field can solve the same problem, please tell me how to do it, and please give me example how to append, update and retrieve the data.

Thanks from apin.
ASKER CERTIFIED SOLUTION
Avatar of Igor UL7AAjr
Igor UL7AAjr
Flag of Kazakhstan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of kretzschmar
hmm pc_melsa,

the answer will cause,
that only the application will be able to edit/retrieve
the array-values

i would recommend to forget the array
and store the values in a record with a structure like

name
date
hour

with primary key over all three fields or adding a sequence-number as id like

id
name
date
hour

this will cause in one record
per name per day per hour and is much easier to handle and will save space by none leap-years
additional based on this structure are third-party products
(like Tquickreport, or TDBChart, or TDecisioncube) able to retrieve and calculate with this records

just a suggestion, igors will work also

meikl
Dear Mr. Igors
    Thanks for your answers, may God Bless you.

Best Regards,
apin
Dear Mr. Meikl,
   Thanks for your suggestion, may God Bless you.

Best Regards,
apin