Skip to end of metadata
Go to start of metadata


Overview

ALTIBASE HDB's directory object is almost identical to ORACLE.

Notices

There are some notices to bear in mind prior to handling DIRECTORY object.

  • To use a DIRECTORY, the creation of the DIRECTORY object should be in advance.
  • READ/WRITE Privilege for corresponding directory should be granted to user.
  • The directory parameter must be specified in upper-case letters.
    v1 := fopen(‘MYDIR’, ‘data1.dat’, ‘w’);
  • File open mode should be in the lower case, duplicate use is prohibited.
     

Restriction on the Directory name

Even if the name of the directory object was specified in lower-case letters, the names of all objects are stored in upper-case letters in the database.

Therefore when specifying the name of a directory object as a parameter for a system procedure or function, it is necessary to use upper-case letters.

Example

ORACLE

ALTIBASE HDB

Comments

CREATE [OR REPLACE] DIRECTORY mydir AS '/dir/file_data';
DROP DIRECTORY mydir;

CREATE [OR REPLACE] DIRECTORY mydir AS '/dir/file_data' ;
DROP DIRECTORY mydir;

 

CREATE DIRECTORY ALTI AS ‘/altibase’;

CREATE OR REPLACE PROCEDURE bulk_insert
AS
  vFile UTL_FILE.FILE_TYPE;
  c1 INTEGER;
BEGIN
  vFile := UTL_FILE.FOPEN(‘ALTI’, ‘data1.dat’, ‘w’);
  FOR c1 IN 1 .. 5000000 LOOP
    UTL_FILE.PUT_LINE(vFile, c1||','||c1||','||LPAD(c1,10,'0')||','||
LPAD(c1,10,'0')||','||LPAD(c1,10,'0')||','||LPAD(c1,10,'0')||','||
LPAD(c1,10,'0')||','||LPAD(c1,10,'0')||','||
TO_CHAR(sysdate,'YYYYMMDDHHMISS'));
  END LOOP;
  UTL_FILE.FFLUSH(vFile);
  UTL_FILE.FCLOSE(vFile);
END;
/

CREATE OR REPLACE DIRECTORY alti AS ‘/altibase’;

CREATE OR REPLACE PROCEDURE bulk_insert
AS  v1 FILE_TYPE;
c1 INTEGER;
BEGIN
v1 := fopen(‘ALTI’, ‘data1.dat’, ‘w’);
FOR c1 IN 1 .. 5000000 LOOP
PUT_LINE(v1, c1||','||c1||','||LPAD(c1,10,'0')||','||LPAD(c1,10,'0')||','||
LPAD(c1,10,'0')||','||LPAD(c1,10,'0')||','||LPAD(c1,10,'0')||','||LPAD(c1,10,'0')||
','||TO_CHAR(sysdate,'YYYYMMDDHHMISS'));
END LOOP;
FFLUSH(v1);
FCLOSE(v1);
END;/

 

  • No labels