Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: PL/SQL Questions
On 2 Nov 1998 23:24:23 GMT, "Ed Wallace" <cdpdnospam_at_rpa.net> wrote:
>Two questions - 1st - knowing that I'm not supposed to use an exit to
>terminate a cursor FOR loop, what is the best way to get a single 'row' of
>data? Is a cursor even the best way? One example of where I am doing this
>is I am selecting and ordering data. I am fetching into a list of
>variables the first ordered occurrence of this data. These variables are
>then written to an output file. Then I exit my cursor. Any better way to
>do this?
Use normal cursor processing, i.e.;
OPEN cursor
FETCH cursor INTO variable(s)
CLOSE cursor
>
>2nd - Another problem I've come across is when I am fetching data from a
>cursor to make up a fixed width output file, one of the fields may contain
>tabs or carriage returns, which messes up the fixed-width file as they are
>interpreted. What is the best way to get rid of them or ignore them? Do I
>need to scan the string and do a replace or something?
>
Whether or not you need to do something with the data depends on your application. If you are producing files which will be read by a program reading fixed length records, i.e.; SQL*Loader, you don't need to do anything about characters like CR. A character is a character. If you read 80 bytes, what does it matter if character 15 is an ASCII 13 (CR)? If you need to replace them, it can be done with SQL but it is somewhat convoluted.
>Thanks in advance
>
>Ed
>
>
Jim Joslin, Managing Principal
Oracle Consulting - Florida
The statements and opinions expressed herein are not to be construed as those of Oracle Corporation. Received on Fri Nov 06 1998 - 00:32:19 CST
![]() |
![]() |