The stored procedures for inserts must return result sets containing all the columns to be uploaded, as defined in the CREATE PUBLICATION statement, in the same order that the columns were declared in the CREATE TABLE statement.
You can find the creation order of columns in a table called T1 with the following query:
SELECT column.name FROM SYSTAB JOIN SYSTABCOL WHERE table_name = 't1' ORDER BY column_id
For a detailed explanation of how to define stored procedures for inserts, see Scripted upload example.
The following example creates a table called t1 and a publication called p1. The publication specifies WITH SCRIPTED UPLOAD and registers the stored procedure t1_insert as the insert procedure. In the definition of the t1_insert stored procedure, the result set includes all columns listed in the CREATE PUBLICATION statement but in the order in which the columns were declared in the CREATE TABLE statement.
CREATE TABLE t1( //The column ordering is taken from here pk integer primary key, c1 char( 30), c2, float, c3 double ); CREATE PROCEDURE t1_insert () RESULT( pk integer, c1 char(30), c3 double ) begin ... end CREATE PUBLICATION WITH SCRIPTED UPLOAD p1( // Order of columns here is ignored TABLE t1( c3, pk, c1 ) USING ( PROCEDURE t1_insert FOR UPLOAD INSERT ) )
|Send feedback about this page via email or DocCommentXchange||Copyright © 2008, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.0|