declare.hlp
上传用户:blenddy
上传日期:2007-01-07
资源大小:6495k
文件大小:2k
- .pgaw:Help.f.t insert end "DECLARE" {bold} " allows a user to create cursors, which can be used to retrieve a small number of rows at a time out of a larger query. Cursors can return data either in text or in binary foramt.
- Normal cursors return data in text format, either ASCII or another encoding scheme depending on how the Postgres backend was built. Since data is stored natively in binary format, the system
- must do a conversion to produce the text format. In addition, text formats are often larger in size than the corresponding binary format. Once the information comes back in text form, the client
- application may have to convert it to a binary format to manipulate it anyway.
- BINARY cursors give you back the data in the native binary representation. So binary cursors will tend to be a little faster since they suffer less conversion overhead.
- " {} "Synopsis" {bold} "
- DECLARE cursor [ BINARY ] [ INSENSITIVE ] [ SCROLL ]
- CURSOR FOR query
- [ FOR [ READ ONLY | UPDATE [ OF column [, ...] ] ]
- " {code} "Usage" {bold} "
- To declare a cursor:
- " {} "
- DECLARE liahona CURSOR
- FOR SELECT * FROM films;
-
- " {code} "Notes" {bold} "
- Cursors are only available in transactions.
- Postgres does not have an explicit OPEN cursor statement; a cursor is considered to be open when it is declared.
- Note: In SQL92 cursors are only available in embedded applications. ecpg, the embedded SQL preprocessor for Postgres, supports the SQL92 conventions, including those
- involving DECLARE and OPEN statements. "