Select Dbms_random.value from dual;
Select mod (Dbms_random.random, ten) from dual;
Select ABS (mod (DBMS_RANDOM.RANDOM)) from dual;
Select + ABS (mod (DBMS_RANDOM.RANDOM)) from dual;
Words: = Dbms_xmlquery.getxml (' select * from Scott.emp ');
XMLSTR: = Dbms_lob.substr (words, 32767);
Exit when (Xmlstr is null);
Line: = substr (Xmlstr, 1, InStr (Xmlstr, Chr (10))-1);
Dbms_output.put_line (Line_no | | ': ' | | line);
XMLSTR: = substr (Xmlstr, InStr (Xmlstr, Chr (10)) + 1);
--Define folder naming must be capitalized
Create directory My_dir as ' D:\TEMP ';
Inputfile Utl_file.file_type; --File Object
--3 parameters are: Folder file open mode [R (Read) W (write) A (append)]
Inputfile: = Utl_file.fopen (' My_dir ', ' demo.txt ', ' R ');
Utl_file.get_line (inputfile, input);
Dbms_output.put_line (input);
Utl_file.fclose (Inputfile);
When No_data_found then Dbms_output.put_line (' End of File! ');
Inputfile Utl_file.file_type; --File Object
Input VARCHAR2: = ' Hello world! ';
--3 parameters are: Folder file open mode [R (Read) W (write) A (append)]
Inputfile: = Utl_file.fopen (' My_dir ', ' mydemo.txt ', ' a ');
Utl_file.put_line (inputfile, input);
Utl_file.fclose (Inputfile);
When No_data_found then Dbms_output.put_line (' End of File! ');
Oracle Note 14, querying XML operations, operating system files