Subject Re: [IBO] using stored procedures.
Author Helen Borrie
At 11:54 AM 11-09-01 +0000, you wrote:
>My previous way of doing things having hit a brick wall I have tried
>a new tack with no success.
>I want a table with a primary key integer
>And then about 200 columns or something that I can use as a diary.

Why do you need to think "columns"?

create table Diary(
DiaryID integer not null,
YearStart date,
YearEnd date,
Description varchar(50),
constraint pk_diary primary key(DiaryID)

create table DiaryEntry(
DiaryEntryID integer not null,
DiaryID integer not null,
UserID integer not null,
DiaryDate date,
DiaryEntry blob sub_type 1,
SpecialEntry smallint,
constraint pk_DiaryEntry primary key(DiaryEntryID)

>I want to access it to put entries in or select entries from using a
>stored proc.

..just select the rows you want..

>Is there any way to access columns in a stored proc other than by

No, you can only pass constants (or expressions that evaluate to constants) to SPs and variables can only represent constants.

>I can get the name out of RDB$Relation_Fields and into a varchar
>variable but I can't use a variable as a field name.

Not on, as above.

>So try to use an array 200 smallints
>But cant get to put a value into an array slice. stored proc language
>seem to allow select from slice but not insert into slice .(I have
>examined the array sample program from Jason but does not seem to
>deal in slices!

Refer to TIB_ColumnArray.GetSlice and PutSlice. But you can't pass arrays to SPs, anyway.

>So I am only dealing with small integers so why not keep these as
>chars in a VarChar(200) column. Yes but stored procedures have no
>string-handling capabilities. So I am no better off.

Firebird 1 has the SUBSTRING function; and there are enhancements to ib_udf.dll for substrings also. See the Language Enhancements and UDFs sections of the draft release notes at


All for Open and Open for All
InterBase Developer Initiative ยท