Oracle® OLAP DML Reference 10g Release 2 (10.2) Part Number B14346-03 |
|
|
View PDF |
The FILEQUERY function returns information about a file. The attribute argument you specify in your FILEQUERY function call determines the type of information that is returned.
Return Value
The data type of the return value depends on the attribute you specify. See Table 15-1, "File Attributes Returned by FILEQUERY" for more information.
Syntax
FILEQUERY(file-id attrib-arg)
Arguments
A fileunit number or a file name.
A fileunit number is a number that Oracle OLAP assigned to a file you opened through a previous call to the FILEOPEN function or through the OUTFILE command. You can use the return value of the FILEOPEN function or the value of the OUTFILEUNIT option.
A file name is a text expression specifying the name of the file you want to move or rename. Unless the file is in the current directory, you must include the name of the directory object in the name of the file.
Note:
Directory objects are defined in the database, and they control access to directories and file in those directories. You can use a CDA statement to identify and specify a current directory object. Contact your Oracle DBA for access rights to a directory object where your database user name can read and write files.Some attributes require that you specify a fileunit number; others require the file name. In many cases, you can specify either. Table 15-1, "File Attributes Returned by FILEQUERY" lists the valid keywords for attrib-arg and, for each keyword, provides a description and indicates whether you specify a file-unit-number of a file-name for the file-id argument.
Specifies the type of information you want to retrieve about the file. The data type of FILEQUERY's return value depends on the attribute you specify. The attribute you specify must be appropriate for the file; otherwise, an error occurs. Table 15-1, "File Attributes Returned by FILEQUERY" lists the valid keywords for attrib-arg and, for each keyword, provides a description and indicates whether you specify a file-unit-number of a file-name for the file-id argument.
Table 15-1 File Attributes Returned by FILEQUERY
Keyword | Return Values | Return Data Type | file-id Argument |
---|---|---|---|
APPEND |
|
|
Fileunit number |
BMARGIN |
The number of blank lines that form the bottom margin. |
|
Fileunit number |
CHANGED |
|
|
Fileunit number or file name |
EOF |
|
|
Fileunit number |
EXISTS |
|
|
Fileunit number or file name |
FILENAME |
The file name associated with the fileunit. |
|
Fileunit number |
LINENUM |
The current line number. Resets after each page break when PAGING is on; keeps incrementing when PAGING is off. When file is currently open in READ mode, returns the current record number. |
|
Fileunit number |
LINESLEFT |
The number of lines left on the page. |
|
Fileunit number |
LSIZE |
For a file that is open for writing, the line length for the standard Oracle OLAP page heading. (See the STDHDR program.) For a fileunit that is open for reading, specifies the record length for binary input files. |
|
Fileunit number |
NAMELIST |
The name of the file (such as |
|
Fileunit number or file name |
NLS_CHARSET |
The character set being used for this fileunit. See FILEOPEN for more information. |
|
Fileunit number |
NUMBYTES |
The size of the file in bytes. |
|
Fileunit number or file name |
ORIGIN |
The type of computer on which the file was created. The ORIGIN attribute, which is relevant only for files that are open for reading, is set when you issue a FILESET statement. |
|
Fileunit number |
PAGENUM |
The current page number. See "Paging Attributes". |
|
Fileunit number |
PAGEPRG |
The Oracle OLAP program or statement that produces headings when output is paged. See "Paging Attributes". |
|
Fileunit number |
PAGESIZE |
The number of lines on each page. See "Paging Attributes". |
|
Fileunit number |
PAGING |
|
|
Fileunit number |
PAUSEATPAGEEND |
|
|
Fileunit number |
R[EAD] |
|
|
Fileunit number |
RO |
|
|
Fileunit number or file name |
SPECLIST |
The name and extension of the file. |
|
Fileunit number or file name |
TABEXPAND |
|
|
Fileunit number or file name |
TMARGIN |
The number of blank lines that form the top margin. |
|
Fileunit number |
UNIT |
The file unit for the specified file name. |
|
File name |
W[RITE] |
|
|
Fileunit number |
Notes
Listing Open Files
You can use a LISTFILES statement to see a list of which open files can be referenced by the FILEQUERY function.
Tab Treatment
When you want tab characters in the source file to be expanded when read by FILEGET or FILEREAD, you can specify the TABEXPAND attribute with the FILESET command. When TABEXPAND is zero, tab characters will not be expanded. A value greater than 0 indicates the distance, in bytes, between tab stops. The default value of TABEXPAND is 8.
Paging Attributes
The paging attributes apply only to files that currently, unless otherwise noted, have PAGING set to YES
and are open in WRITE mode -- such as files opened with FILEOPEN(...WRITE) or FILEOPEN(...APPEND). You can set any of the paging attributes with the FILESET command.
Using FILEQUERY EOF
Use FILEQUERY with the EOF attribute where you used FILESTATUS in previous Oracle OLAP versions.
File Name Conventions
When specifying a file name, use the file naming conventions for your operating system. For example, it might be necessary to type upper, lower, and mixed case letters to match the name of the file for which you want information.
Wildcard Characters
(Unix only) When querying for Unix file names, wildcard characters (that is, * ?
) are allowed when searching with the NAMELIST, SPECLIST, and EXISTS attribute arguments.
Examples
Example 15-7 Setting Paging Options for a File Opened for Writing
The following statements show how the paging options are set for a file opened for writing.
DEFINE fil.unit INTEGER fil.unit = FILEOPEN('REPORT' WRITE)
The statement
SHOW FILEQUERY(fil.unit PAGING)
produces the following output.
YES
The statement
SHOW FILEQUERY(fil.unit PAGESIZE)
produces the following output.
66
The statement
SHOW FILEQUERY(fil.unit TMARGIN)
produces the following output.
5
The statement
SHOW FILEQUERY(fil.unit LINESLEFT)
produces the following output.
61
The following statement closes the file.
FILECLOSE fil.unit