I am using oracle 8i, I am trying to read the first 10 character of the first line I have define br UTL_FILE.FILE_TYPE;
i changed from UTL_FILE.GET_LINE(br, sLine); to UTL_FILE.GET_LINE(br, sLine, 10); - the first 10 characters of the file? and i got this error: PLS-00306: wrong number or types of arguments in call to 'GET_LINE'
br UTL_FILE.FILE_TYPE; if I changed to br := UTL_FILE.FOPEN_NCHAR (strFilePath, strFileName, 'r'); PL/SQL: Statement ignored PLS-00302: component 'FOPEN_NCHAR' must be declared UTL_FILE.GET_LINE_NCHAR (br, sLine) PL/SQL: Statement ignored PLS-00302: component 'GET_LINE_NCHAR' must be declared
are those function only in 9i? appreciated your help. =)
Programs added with version 9i FOPEN FOPEN FOPEN_NCHAR FOPEN_NCHAR GET_LINE_NCHAR PUT_NCHAR PUT_LINE_NCHAR PUTF_NCHAR
I got this Revealnet's Knowledge base. So it looks like those are for 9i. Sorry. You just want the first ten characters. Here's a way. Assumption #1. The first ten characters are always on the first line. use GET_LINE, then in you next statement assign the first ten characters to another variable. If you have
Something like that. Or if the first ten characters are not always on the first line then you need to loop and continue reading lines until the length of trim(firstTen) = 10. Also you need to have an IF to make sure that the strBuffer is not more than ten and act accordingly in your assignment of firstTen, such that you don't try to add characters that make it go over it's 10 character limit. Good Luck and I hope that helps. Mark
srikanth sankurthi wrote:can you post your total code.
The original post is from about 10 years ago, and refers to Oracle 8i, so the code may not be all that helpful these days!
The usual way to read file data in PL/SQL is with the UTL_FILE package, which is well documented on the Oracle website as well as via various examples on other sites. If you have a specific question, you can post it here or on the Oracle Technet forums.