The SELECT statement is used to retrieve values from results sets. Once retrieved, these values can be stored in tables or used to set variables.
CREATE PROCEDURE test( INOUT parm CHAR(128) ) URL 'HTTP://localhost/test' TYPE 'HTTP'; |
Because it is of type HTTP, this procedure returns the two-column result set described in the previous section. In the first column is an attribute name; in the second column the attribute value. The keywords are as in the HTTP response header fields. A Body attribute contains the body of the message, which is typically an HTML document.
One approach is to insert the result sets into a table, such as the following one:
CREATE TABLE StoredResults( Attribute LONG VARCHAR, Value LONG VARCHAR ); |
Result sets can be inserted into this table as follows:
INSERT INTO StoredResults SELECT * FROM test('Storing into a table') WITH (Attribute LONG VARCHAR, Value LONG VARCHAR); |
You can add clauses according to the usual syntax of the SELECT statement. For example, if you want only a specific row of the result set you can add a WHERE clause to limit the results of the select to only one row:
SELECT Value FROM test('Calling test for the Status Code') WITH (Attribute LONG VARCHAR, Value LONG VARCHAR) WHERE Attribute = 'Status'; |
This statement selects only the status information from the result set. It can be used to verify that the call was successful.
Discuss this page in DocCommentXchange. Send feedback about this page using email. |
Copyright © 2009, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.1 |