PREPARE SET SCROLL SET SCROLLROW
LEFT
This command shifts the displayed output of a SELECT command to begin with a column to the left of the current first column of the output.
This command enables you to view a wide report on a device whose LINESIZE is smaller than the DEVICESIZE.
This command does not affect the column-IDs of the columns in the select list.
Clauses
number of columns
This indicates how many columns to the left of the currently displayed first column to shift the report.
If the specified number is greater than the number of columns existing to the left, then the report begins at the first column. Columns that you specified as PRINT OFF in the COLUMN command are ignored.
Example
SELECT ITEMNO, ITEM, COST FROM INVENTORY; ITEMNO ITEM COST
====== ========= ==== 1 CHOCOLATE 1.59 2 COCOA 2.48 3 COLA 1.46
LIST
First, the RIGHT command displays the rightmost column first.
RIGHT 2;
SELECT ITEMNO, ITEM, COST FROM INVENTORY; COST
==== 1.59 2.48 1.46
The LEFT command shifts the column, making the column to the left of the current first column the leftmost column.
LEFT 1;
SELECT ITEMNO, ITEM, COST FROM INVENTORY; ITEM COST ========= ==== CHOCOLATE 1.59 COCOA 2.48 COLA 1.46
See also
COLUMN RIGHT SET DEVICESIZE SET LINESIZELIST
This command displays the most recently-entered command. This command lets you view the input before editing it with the EDIT command.
Clauses
line number
This indicates the line of the command to list. If you did not specify a line, the
LIST
Examples
SELECT A, B, C FROM TAB1 WHERE A = 'N';
LIST;
SELECT A, B, C FROM TAB1 WHERE A = 'N'
LIST 1;
SELECT A, B, C FROM TAB1
See also
EDIT
PAUSE
This command suspends the SQLTalk session until you press the enter key. This command can be used in a SQLTalk command file to cause a pause between groups of commands or to mark a transition point.
Example
PAUSE;
See also
REMARK
PERFORM
This command runs a PREPAREd (compiled) SQL command or procedure. You must execute the PERFORM command immediately after a PREPARE command.
PAUSE
PREPARE
You can bind data to variables before execution.
For SELECT commands, the PREPARE/PERFORM sequence only initializes for the first FETCH. SQLBase does not automatically fetch rows; you must explicitly request that rows be fetched with the FETCH command.
For SQL commands other than SELECT, the behavior of the PREPARE/PERFORM sequence is the same as if the SQL command had been entered from the keyboard or from a RUN file.
Example
PREPARE PROCEDURE pr_pres Local Variables
Sql Handle Cur1 Actions
Call SqlConnect (Cur1)
Call SqlStore (Cur1, 'presname', 'Select pres_name from \ sysadm.president')
Call SqlDisconnect (Cur 1); PERFORM;
See also
FETCH PREPARE SET SCROLL SET SCROLLROWPREPARE
This command compiles a SQL command or procedure that is not stored, but does not execute it.
Four things happen when SQLBase compiles a SQL command or procedure:
1. The command itself or the SQL commands in the procedure are parsed. SQLBase detects syntax errors and verifies the existence of database objects.
3. SQLBase determines the execution plan, finding the optimal access path to the data.
4. SQLBase translates the command or commands into a series of executable modules.
If you do not precompile commands with PREPARE, you must compile them at run time. In a production application, precompilation makes complex SQL operations perform better.
Clauses
SQL command/procedure
Specify the command or procedure to compile. You cannot prepare a stored command or stored procedure.
Example
The following example prepares a SQL command:
PREPARE SELECT * FROM CUST WHERE CUST_NAME = 'jones';
The following example prepares a procedure:
PREPARE PROCEDURE WithDraw Parameters NUMBER: nAccount NUMBER: nAmount RECEIVE NUMBER:nNewBalance Local Variables STRING sUpdate STRINGsSelect Actions
SET sUpdate = 'UPDATE Checking SET \
Balance = Balance - :nAmount '|| 'WHERE \ AccountNum = :nAccount'
CALL SQLImmediate(sUpdate)
SET sSelect ='SELECT Balance FROM Checking ' || \ 'WHERE AccountNum = :nAccount ' || \
'INTO :nNewBalance' CALL SQLImmediate(sSelect); PERFORM \ 100, 200, 0 /
See also
EXECUTE FETCH PERFORM SET SCROLL SET SCROLLROWThis command prints a report on a printer or writes a report to an external file. When you enter the PRINT command, it causes the specified command file to be run (see the RUN command) and the results are printed or written to a specified file.
Clauses
command file
This file contains SQLTalk report formatting commands and one SELECT command. The file can be produced with the SAVE REPORT command. You can also produce a command file manually.
If any of the commands result in an error, an error message is displayed on the screen and the report is not produced.
All commands after the first SELECT are ignored.
If the command file name is omitted, the most recent SQL command is executed and the results printed.
TO output file
This names the file where the report lines are written. If the TO clause is omitted, report lines are sent to the system printer.
Examples
This command prints the results of the most recently-executed command on the system printer.
This command prints the results of the command file MYREPORT on the system printer.
PRINT MYREPORT;
This command writes the results of the command file MYREPORT to the file MYREPORT.RPT.
PRINT MYREPORT TO MYREPORT.RPT;
See also
RUN
SAVE REPORT