To use an SQL API to create an SPL routine, put the text of the CREATE PROCEDURE or CREATE FUNCTION statement in a file. Use the CREATE PROCEDURE FROM or CREATE FUNCTION FROM statement and refer to that file to compile the routine. For example, to create a routine to read a customer name, you can use a statement such as the one in the previous example and store it in a file. If the file is named read_add_source, the following statement compiles the read_address routine:
CREATE PROCEDURE FROM 'read_add_source';
The following example shows how the previous SQL statement looks in an ESQL/C program:
/* This program creates whatever routine is in * * the file 'read_add_source'. */ #include <stdio.h> EXEC SQL include sqlca; EXEC SQL include sqlda; EXEC SQL include datetime; /* Program to create a routine from the pwd */ main() { EXEC SQL database play; EXEC SQL create procedure from 'read_add_source'; }Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]