Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2005.08.28;
Скачать: CL | DM;

Вниз

Как задекларировать BASED ON переменную   Найти похожие ветки 

 
ali_tash   (2005-07-18 19:31) [0]

У меня не получается задекларировать BASED ON (как %TYPE в ORACLE) переменную в хранимой процедуре
Пож приведите пример как можно это сделать.


 
Desdechado ©   (2005-07-18 20:21) [1]

AFAIK, в ХП поддерживаются только простые типы данных для переменных


 
ali_tash   (2005-07-19 06:16) [2]

Но где тогда её можно  использовать ?


 
Digitman ©   (2005-07-19 08:35) [3]


> где тогда её можно  использовать ?


только в IB EmbeddedSQL

в PSQL/ISQL/DSQL декларативная статья BASED ON неприменима и недопустима

цитата из штатной док-ции по IB6 EmbeddedSQL:

Using BASED ON to declare variables
InterBase supports a declarative clause, BASED ON, for creating C language character
variables based on column definitions in a database. Using BASED ON ensures that the
resulting host-language variable is large enough to hold the maximum number of
characters in a CHAR or VARCHAR database column, plus an extra byte for the
null-terminating character expected by most C string functions.
BASED ON uses the following syntax:
BASED ON < dbcolumn> hostvar;
For example, the following statements declare two host variables, fname, and lname,
based on two column definitions, FIRSTNAME, and LASTNAME, in an employee database:
BASED ON EMP.FIRSTNAME fname;
BASED ON EMP.LASTNAME lname;
Embedded in a C or C++ program, these statements generate the following host- variable
declarations during preprocessing:
char fname[26];
char lname[26];
To use BASED ON, follow these steps:
1. Use SET DATABASE to specify the database from which column definitions are
to be drawn.
2. Use CONNECT to attach to the database.
3. Declare a section with BEGIN DECLARE SECTION.
4. Use the BASED ON statement to declare a string variable of the appropriate
type.
The following statements show the previous BASED ON declarations in context:
EXEC SQL
SET DATABASE EMP = ’employee.gdb’;
EXEC SQL
CONNECT EMP;
EXEC SQL
BEGIN DECLARE SECTION;
int empno;
BASED ON EMP.FIRSTNAME fname;
BASED ON EMP.LASTNAME lname;
EXEC SQL
END DECLARE SECTION;



Страницы: 1 вся ветка

Текущий архив: 2005.08.28;
Скачать: CL | DM;

Наверх




Память: 0.47 MB
Время: 0.041 c
8-1112443806
dimka@cs
2005-04-02 16:10
2005.08.28
уровень громкости


14-1122904640
oldman
2005-08-01 17:57
2005.08.28
Кто нибудь боролся с Яхой?


3-1121338676
erika
2005-07-14 14:57
2005.08.28
Построение запросов и поиск по полям


5-1095098525
Константинов
2004-09-13 22:02
2005.08.28
Свойства массивы в процедуре Assign


14-1122835504
Гаврила
2005-07-31 22:45
2005.08.28
Во Вторую Мировую Войну СССР вступил на стороне