Writetofile error -- SYS.UTL_FILE

I get below error when I use "dbms_xmldom.writetofile(doc,'output.xml')"
ORA-04067: not executed, package body "SYS.UTL_FILE" does not exist
Is this because the read-from and write-to directories in the initialization.ora file hasn't been specified? Thanks.

Yes, and permissions to use UTL_FILE have been tightened up.

Similar Messages

  • Sys.utl_file has many errors. How to re-create

    hi all,
    I tried using the utility utl_file in my procedures and it showed out
    sys.utl_file has many errors
    and when i went through like
    $ sqlplus /nolog
    SQL*Plus: Release 9.2.0.8.0 - Production on Tue Mar 4 12:50:08 2008
    Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
    SQL> connect / as sysdba;
    Connected.
    SQL> select name from v$database;
    NAME
    TEST
    SQL> alter package sys.utl_file compile body;
    Warning: Package Body altered with compilation errors.
    SQL> show errors;
    Errors for PACKAGE BODY SYS.UTL_FILE:
    LINE/COL ERROR
    100/12 PLS-00323: subprogram or cursor 'FOPEN_NCHAR' is declared in a
    package specification and must be defined in the package body
    160/13 PLS-00323: subprogram or cursor 'GET_LINE' is declared in a
    package specification and must be defined in the package body
    181/13 PLS-00323: subprogram or cursor 'GET_LINE_NCHAR' is declared in a
    package specification and must be defined in the package body
    213/13 PLS-00323: subprogram or cursor 'PUT_NCHAR' is declared in a
    package specification and must be defined in the package body
    LINE/COL ERROR
    245/13 PLS-00323: subprogram or cursor 'PUT_LINE' is declared in a
    package specification and must be defined in the package body
    261/13 PLS-00323: subprogram or cursor 'PUT_LINE_NCHAR' is declared in a
    package specification and must be defined in the package body
    311/13 PLS-00323: subprogram or cursor 'PUTF_NCHAR' is declared in a
    package specification and must be defined in the package body
    336/7 PLS-00307: too many declarations of 'PUT_LINE' match this call
    LINE/COL ERROR
    336/7 PL/SQL: Statement ignored
    344/13 PLS-00323: subprogram or cursor 'PUT_RAW' is declared in a
    package specification and must be defined in the package body
    363/13 PLS-00323: subprogram or cursor 'GET_RAW' is declared in a
    package specification and must be defined in the package body
    386/13 PLS-00323: subprogram or cursor 'FSEEK' is declared in a package
    specification and must be defined in the package body
    403/13 PLS-00323: subprogram or cursor 'FREMOVE' is declared in a
    LINE/COL ERROR
    package specification and must be defined in the package body
    423/13 PLS-00323: subprogram or cursor 'FCOPY' is declared in a package
    specification and must be defined in the package body
    447/13 PLS-00323: subprogram or cursor 'FGETATTR' is declared in a
    package specification and must be defined in the package body
    463/12 PLS-00323: subprogram or cursor 'FGETPOS' is declared in a
    package specification and must be defined in the package body
    LINE/COL ERROR
    481/13 PLS-00323: subprogram or cursor 'FRENAME' is declared in a
    package specification and must be defined in the package body
    SQL>
    can anyone help me out of this issue

    What had happened to your database?
    You could try to run $ORACLE_HOME/rdbms/admin/utlfile.sql
    to recreate the package.

  • Runtime error using utl_file package

    Hi Friends,
    This is the procedure for reading sample data from flat file , but it won't work.
    create or replace procedure test_utl_file
    is
    ftype utl_file.file_type;
    ch varchar2(200);
    begin
    ftype := utl_file.FOPEN('C:\oracle\temp','data.txt,R');
    utl_file.get_line(ftype,ch);
    dbms_output.put_line(ch);
    end;
    This code is compiled succesfully , but at runtime it shows an error msg
    ORA-29280: invalid directory path
    ORA-06512: at "SYS.UTL_FILE", line 33
    ORA-06512: at "SYS.UTL_FILE", line 436
    ORA-06512: at "SCOTT.TEST_UTL_FILE", line 7
    ORA-06512: at line 1
    I had entered the directory entry in int.ora file
    utl_file_dir=C:\oracle\temp
    & i used another way also,
    by using alter set utl_file_dir=C:\oracle\temp scope=spfile;
    Can anyone help me to resolve this problem.
    Rgrds,
    Anand

    What database version are you using?
    The UTL_FILE_DIR parameter has been deprecated by oracle in favour of direcory objects because of it's security problems.
    The correct thing to do is to create a directory object e.g.:
    CREATE OR REPLACE DIRECTORY mydir AS 'c:\myfiles';
    Note: This does not create the directory on the file system. You have to do that yourself and ensure that oracle has permission to read/write to that file system directory.
    Then, grant permission to the users who require access e.g....
    GRANT READ,WRITE ON DIRECTORY mydir TO myuser;
    Then use that directory object inside your FOPEN statement e.g.
    fh := UTL_FILE.FOPEN('MYDIR', 'myfile.txt', 'r');
    Note: You MUST specify the directory object name in quotes and in UPPER case for this to work as it is a string that is referring to a database object name which will have been stored in uppercase by default.

  • DBMS_XMLDOM.WRITETOFILE errors

    C'mon then chaps (and chapesses)...
    I've had DBMS_XMLDOM.WRITETOFILE working before but for some reason I just can't seem to get it to work again. (Using Oracle 10g R2)
    What am I doing wrong. It's bound to be something right in front of me, but I just can't see it.
    create or replace directory utl_data as 'C:\';
    declare
      xd  DBMS_XMLDOM.DOMDocument;
      xt  XMLTYPE;
      CURSOR cur_xml IS
        select xmlelement("fred", 'fred') from dual;
    begin
      OPEN cur_xml;
      FETCH cur_xml INTO xt;
      CLOSE cur_xml;
      xd := DBMS_XMLDOM.NewDOMDocument(xt);
      DBMS_XMLDOM.WRITETOFILE(xd, 'C:\FRED.XML');
    end;
    ORA-29280: invalid directory path
    ORA-06512: at "SYS.UTL_FILE", line 33
    ORA-06512: at "SYS.UTL_FILE", line 436
    ORA-06512: at "XDB.DBMS_XSLPROCESSOR", line 217
    ORA-29280: invalid directory path
    ORA-29280: invalid directory path
    ORA-06512: at "XDB.DBMS_XMLDOM", line 4416
    ORA-06512: at line 12

    Well that's very nice of you to answer my thread after a year, but I already know about using directory objects now.
    I'm not quite sure what you are trying to show with you examples, but good luck to you anyway.

  • ORA-06512: at "SYS.UTL_FILE

    Hi All,
    Please have a look into the issue and respond me accordingly...
    Wed Jun 9 22:20:07 MDT 2010
    Checked for pattern ORA-. Excluded these patterns checked by other processes - ORA-16 ORA-32 and excluded these patterns that were not desired - ORA-1652
    ORA-12012: error on auto execute of job 400721
    ORA-29285: file write error
    ORA-06512: at "SYS.UTL_FILE", line 77
    ORA-06512: at "SYS.UTL_FILE", line 691
    ORA-06512: at "COMMISSIONS.CM_CREATE_INVREP", line 251
    ORA-06512: at "COMMISSIONS.CM_CREATE_INVREP", line 1216
    ORA-29285: file write error
    ORA-06512: at line 1
    Database is :-10.2.0.4.0
    Server :-HP-UX
    Thanks
    Vimlendu

    Please check if you read/write permission on UTL_FILE directory location.
    Also check out for available space.
    Regards
    Rajesh

  • SSRS Report Manager error "Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 500"

    Hi All,
    I am getting error "Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 500"
    in one of my Test Environment when trying to run the SSRS 2012 report from report manager.
    Any clue why it is happening.
    Thanks Shiven:) If Answer is Helpful, Please Vote

    Hi All,
    Upon investigation found that there was no space (0 Byte is available) in E drive where underlying SQL DB is residing. 
    Once I cleared the space, report started working and above error was not displaying. 
    Thanks Shiven:) If Answer is Helpful, Please Vote

  • SYS.UTL_FILE does not exists...

    Hi!
    I use 'utl_file.fopen' in a PL/SQL Package. It works fine with ORACLE 8.1.7 and now with ORALCE 9.2 it breaks.
    First I have create a directory 'UTL_FILE_TMP' and grant it to the PL/SQL user.
    At the code 'v_file := utl_file.fopen('UTL_FILE_TMP',v_name, 'a');' I get the ORAERR 04067 --> SYS.UTL_FILE does not exists...
    Have I install the package seperatly and when yes, how can I do?
    Regars
    -mic

    I really doubt that you have a directory called UTL_FILE_TMP, "C:\UTL_FILE_TMP" on a winows machine, "u01/UTL_FILE_TMP" on a unix machine I can believe, but a volume labeled "UTL_FILE_TMP", I don't You MUST have the full directory path the the directory and the directory MUST be writable by the user (typically oracle) that is running the database code.

  • [SOLVED] Error : sys\stat.h: No such file or directory

    I get "...sys\stat.h: No such file or directory" error when compiling a simple C program. i have been searching for a while on web and see people writing "# pacman -S base-devel" i have that already and some more packages like glib ...
    These are the includes i am using :
    #include <stdio.h>
    #include <stdlib.h>
    #include <io.h>
    #include <fcntl.h>
    #include <sys\stat.h>
    // here is when i use the libraries sys/stats.h
    struct stat stbuf;
    stat(argv[2], &stbuf);
    int infSize = stbuf.size;
    This is the output of the command "gcc -o copy copy.c" :
    copy.c:3:16: error: io.h: No such file or directory
    copy.c:5:22: error: sys\stat.h: No such file or directory
    copy.c: In function 'main':
    copy.c:35: error: storage size of 'stbuf' isn't known
    Either i am missing any package needed or the gcc compiler is missing any lib directory. But i dont know which one is it.
    Any ideas are apreciated. Thanks you
    EDIT : The error was actually on #Include <io.h> , but i dunno why it conflicted with #include <sys\stat.h>.
    Anyway Problem Solved.
    Last edited by puzzled (2008-10-05 17:07:03)

    If you're not sure if you have the SDKs, can you confirm you have the files under /Developer? Check for /Developer/SDKs/MacOSX10.4u.sdk/usr/X11R6/include/X11
    I don't remember having to do anything special to get gcc to find these files.
    From what I've noted, the usual trigger seems to be that the X11SDK.pkg package wasn't installed.
    Typical PATH export is:
    export PATH="/bin:/sbin:/usr/bin:/usr/sbin"
    If you're working with Fink, there's a call to the following needed:
    . /sw/bin/init.sh
    See http://finkproject.org/doc/users-guide/install.php
    But I'd first make sure the X11 SDK was installed. I'd guess that is missing.

  • Error: [SYS/PERM] Temporary drop /var/mail/.user1.pop not owned by user1

    Hello mac eXperts,
    I get error "[SYS/PERM] Temporary drop /var/mail/.user1.pop not owned by user1". I'm trying to find temporary folder and .user1.pop file to delete it but I can't find it. Any suggestion?
    I think to solve this error is deleting .user1.pop, but not sure. If someone could give me a hand I appreciate.
    Thank you.
    Joe
    Mac Pro   Mac OS X (10.4.7)  

    Joe,
    Let's go to some basics. How many accounts do you have, and how many of them of POP accounts? In the Finder, open Home/Library/Mail and check to see if there are the same number of POP account folders, as you have POP addresses? Is the name of the POP folder for the account that is not working, of the same form and structure, as the others?
    Open the POP folder for this account, and report the files and folders at its root level? Next, open the INBOX.mbox folder in this POP account folder, and report the files and folders at its root level?
    In all the names of the files related to this account's POP folder, are there any slashes (/)?
    Ernie

  • HELP - mail error [SYS/PERM]

    iMac Intel, Mac OS 10.8.4, email POP home user account, only one user.
    Shortly after upgrading to Mac OS 10.8.4 (from 10.6.8) this problem started.
    I can send email but cannot receive them, I got error [SYS/PERM].
    I cannot find anything like that on the WEB but for server.
    All the account setting are OK (unchanged), I can access my email on the WEB connection with the same user name and password. My provider say that their system is not the problem (after checking all the setting with them).
    What have been done:
    Repair permission.
    Check if the mail folder and the login.keychain was read/write for the user.
    Repair disk from an external drive.
    Zap PRAM
    Delete the mail account and recreate it.
    Removing the mail folder, creating a new empty one, and recreating the setting.
    MORE:
    Starting up from an external hard drive, clean system, creating a new mail account with the same setting.
    ALWAYS the same error [SYS/PERM]
    Somebody have a clue

    Thank for your answer Linc
    This is what I got from Mail and also from Outlook 2011
    The screen shot is from Outlook, the text is from Mail - I put the error in bold at the end of the text.
    Mail:
    INITIATING CONNECTION Sep 20 07:05:32.299  -- host:pop.videotron.ca -- port:110 -- socket:0x0 -- thread:0x7f8bac9984f0
    INITIATING CONNECTION Sep 20 07:05:32.299  -- host:relais.videotron.ca -- port:25 -- socket:0x0 -- thread:0x7f8baac20660
    CONNECTED Sep 20 07:05:32.606 [kCFStreamSocketSecurityLevelNone]  -- host:pop.videotron.ca -- port:110 -- socket:0x7f8bacbbc000 -- thread:0x7f8bac9984f0
    CONNECTED Sep 20 07:05:32.609 [kCFStreamSocketSecurityLevelNone]  -- host:relais.videotron.ca -- port:25 -- socket:0x7f8bac9da0a0 -- thread:0x7f8baac20660
    READ Sep 20 07:05:32.622 [kCFStreamSocketSecurityLevelNone]  -- host:relais.videotron.ca -- port:25 -- socket:0x7f8bac9da0a0 -- thread:0x7f8baac20660
    220 relais.videotron.ca -- Server ESMTP (Videotron Ltee)
    WROTE Sep 20 07:05:32.634 [kCFStreamSocketSecurityLevelNone]  -- host:relais.videotron.ca -- port:25 -- socket:0x7f8bac9da0a0 -- thread:0x7f8baac20660
    EHLO [192.168.0.170]
    READ Sep 20 07:05:32.639 [kCFStreamSocketSecurityLevelNone]  -- host:pop.videotron.ca -- port:110 -- socket:0x7f8bacbbc000 -- thread:0x7f8bac9984f0
    +OK Messaging Multiplexor (Oracle Communications Messaging Server 7.4-27.01 (built Aug 30 2012))
    READ Sep 20 07:05:32.642 [kCFStreamSocketSecurityLevelNone]  -- host:relais.videotron.ca -- port:25 -- socket:0x7f8bac9da0a0 -- thread:0x7f8baac20660
    250-relais.videotron.ca
    250-8BITMIME
    250-PIPELINING
    250-DSN
    250-ENHANCEDSTATUSCODES
    250-HELP
    250-XLOOP BB6C6465D1127719EFC60828060F63B6
    250-ETRN
    250-NO-SOLICITING
    250 SIZE 35840000
    WROTE Sep 20 07:05:32.653 [kCFStreamSocketSecurityLevelNone]  -- host:pop.videotron.ca -- port:110 -- socket:0x7f8bacbbc000 -- thread:0x7f8bac9984f0
    CAPA
    WROTE Sep 20 07:05:32.656 [kCFStreamSocketSecurityLevelNone]  -- host:relais.videotron.ca -- port:25 -- socket:0x7f8bac9da0a0 -- thread:0x7f8baac20660
    EHLO [192.168.0.170]
    READ Sep 20 07:05:32.685 [kCFStreamSocketSecurityLevelNone]  -- host:relais.videotron.ca -- port:25 -- socket:0x7f8bac9da0a0 -- thread:0x7f8baac20660
    250-relais.videotron.ca
    250-8BITMIME
    250-PIPELINING
    250-DSN
    250-ENHANCEDSTATUSCODES
    250-HELP
    250-XLOOP BB6C6465D1127719EFC60828060F63B6
    250-ETRN
    250-NO-SOLICITING
    250 SIZE 35840000
    READ Sep 20 07:05:32.697 [kCFStreamSocketSecurityLevelNone]  -- host:pop.videotron.ca -- port:110 -- socket:0x7f8bacbbc000 -- thread:0x7f8bac9984f0
    +OK list follows
    TOP
    PIPELINING
    UIDL
    RESP-CODES
    AUTH-RESP-CODE
    USER
    SASL PLAIN
    IMPLEMENTATION MMP-7.4p27.01 Aug 30 2012
    WROTE Sep 20 07:05:32.702 [kCFStreamSocketSecurityLevelNone]  -- host:relais.videotron.ca -- port:25 -- socket:0x7f8bac9da0a0 -- thread:0x7f8baac20660
    QUIT
    WROTE Sep 20 07:05:32.705 [kCFStreamSocketSecurityLevelNone]  -- host:pop.videotron.ca -- port:110 -- socket:0x7f8bacbbc000 -- thread:0x7f8bac9984f0
    AUTH PLAIN
    READ Sep 20 07:05:32.738 [kCFStreamSocketSecurityLevelNone]  -- host:pop.videotron.ca -- port:110 -- socket:0x7f8bacbbc000 -- thread:0x7f8bac9984f0
    +
    WROTE Sep 20 07:05:32.753 [kCFStreamSocketSecurityLevelNone]  -- host:pop.videotron.ca -- port:110 -- socket:0x7f8bacbbc000 -- thread:0x7f8bac9984f0
    READ Sep 20 07:05:47.819 [kCFStreamSocketSecurityLevelNone]  -- host:pop.videotron.ca -- port:110 -- socket:0x7f8bacbbc000 -- thread:0x7f8bac9984f0
    -ERR [SYS/PERM] Internal authentication error
    WROTE Sep 20 07:05:47.824 [kCFStreamSocketSecurityLevelNone]  -- host:pop.videotron.ca -- port:110 -- socket:0x7f8bacbbc000 -- thread:0x7f8bac9984f0
    USER xxxxxxxxxxx
    READ Sep 20 07:05:47.877 [kCFStreamSocketSecurityLevelNone]  -- host:pop.videotron.ca -- port:110 -- socket:0x7f8bacbbc000 -- thread:0x7f8bac9984f0
    +OK password required for user xxxxxxxxxx
    WROTE Sep 20 07:05:47.882 [kCFStreamSocketSecurityLevelNone]  -- host:pop.videotron.ca -- port:110 -- socket:0x7f8bacbbc000 -- thread:0x7f8bac9984f0
    PASS ******
    READ Sep 20 07:06:04.951 [kCFStreamSocketSecurityLevelNone]  -- host:pop.videotron.ca -- port:110 -- socket:0x7f8bacbbc000 -- thread:0x7f8bac9984f0
    WROTE Sep 20 07:06:04.955 [kCFStreamSocketSecurityLevelNone]  -- host:pop.videotron.ca -- port:110 -- socket:0x7f8bacbbc000 -- thread:0x7f8bac9984f0
    QUIT
    READ Sep 20 07:06:04.987 [kCFStreamSocketSecurityLevelNone]  -- host:pop.videotron.ca -- port:110 -- socket:0x7f8bacbbc000 -- thread:0x7f8bac9984f0
    +OK goodbye

  • Error: SYS-170101 System Exception Signal 6 occurred in the context.

    Hi,
    The following error appears while executing a job.
    SYS-170101 System Exception <Signal 6> occurred in the context.
    DS version: BOXI 3.2
    Source: Oracle
    Target SAP BW
    Job Server is on AIX
    Has anybody dealt with this error?  Any suggestions wil be a great help.
    Thanks in advance.
    Hitesh

    Hi Expert,
    I am also facing same error, can anyone please let help in it?

  • Error in UTL_FILE

    Hi,
    I am working in oracle9i . I am using UTL_FILE to read and write a file in oracle.
    If i use the procedure means.
    SQL> CREATE OR REPLACE PROCEDURE test_utl IS
    2 id UTL_FILE.FILE_TYPE;
    3 BEGIN
    4 id := UTL_FILE.FOPEN('/oracle/data',
    5 'test.txt',
    6 'W');
    7 UTL_FILE.FCLOSE(id);
    8 END test_utl;
    9 /
    Warning: Procedure created with compilation errors
    its showing error as.
    SQL> show errors;
    Errors for PROCEDURE GETR_ERECS.TEST_UTL:
    LINE/COL ERROR
    2/6 PLS-00201: identifier 'UTL_FILE' must be declared
    2/6 PL/SQL: Item ignored
    4/3 PLS-00320: the declaration of the type of this expression is incomplete or malformed
    4/3 PL/SQL: Statement ignored
    7/19 PLS-00320: the declaration of the type of this expression is incomplete or malformed
    7/3 PL/SQL: Statement ignored
    SQL>
    Kindly provide me the solutions
    rgds,

    In addition,
    You need to have DIRECT access to utl_file, not via a role.
    Normally, UTL_FILE is granted to public. Your DBA must have revoked it. You need to ask them to grant it to you.

  • Export -import error  'SYS.DBMS_DATAPUMP'

    1-->Hi I exported data from oracle10 g by imp utility.on the same server
    Now I want to import the dump file on the oracle 9i user.
    when I give command on linux server
    c:\> imp username/password@oracle9i ..
    It will give mi error as
    UDI-00008: operation generated ORACLE error 6550
    ORA-06550: line 1, column 52:
    PLS-00201: identifier 'SYS.DBMS_DATAPUMP' must be declared
    ORA-06550: line 1, column 52:
    PL/SQL: Statement ignored
    Can you tell mi what is this error ?
    2-->After that I tried to export data of oracle10g user from oracle 9i exp utility
    but in some tables it give mi error as
    . . exporting table QRTZ_JOB_DETAILS
    EXP-00003: no storage definition found for segment(17, 31315)
    whts the error ?
    3-How Can I create the replica of schema from oracle10g to oracle 9i.?

    To transfer data from any lower version you must use the lower version exp against the higher version database.
    So 9i exp against 10g database.
    Apart from that, datapump is incompatible with exp/imp
    This has been posted NUMEROUS times!!!
    Is there any reason why you can't use the 'Search Forum' function, prior to posting?
    Please use the 'Search Forum' function always prior to posting, in order to avoid redudant posts and more clutter.
    Thank you,
    Sybrand Bakker
    Senior Oracle DBA

  • Muvo TX/File Error Sys

    Hey people,
    I have a problem with my Muvo TX USB 2.0 :
    when i try to switch on my mp3, "File Error System" appears on the screen and the player switches off on its own.
    When I plug it in my laptop, i'm unable to access the hard dri've but I can see the player's supposed not to have any free space (O octets) !! But I have no file into it...
    I can't do a single thing with it !
    Please help !
    I'd really like to solve this problem !

    Trifina wrote:
    I tried that already and got an error message telling to put the device in recovery mode (which i can't while I can't access the harddri've...)
    Thank you anyway for your help...
    You get into Recovery Mode by connecting the player to your PC while pressing and holding the Play button - it's not like the Hard Dri've players where you start the player in a certain way to access Rescue Mode on the player. The TX doesn't have a hard dri've only flash memory.
    You need to install the drivers onto your PC first as they contain the Recovery Mode drivers.
    PB

  • Using to pass the current user while creating a procedure

    I have a .sql script that several people use to help set-up test beds but some users call the test procedures from a separate schema. The .sql creates a table (TABLE_A) and then a procedure that when run will create a trigger on a separate table (TABLE_B) that basically writes all info to TABLE_A. The problem is that if the .sql is run under schema SCOTT and then the procedure is run from schema JOE to create a trigger on JOE.TABLE_B, the trigger will try to write copy info to just TABLE_A instead of SCOTT.TABLE_A. My plan is to add a new input variable to the procedure for the schema where the procedure is located and set the default to the schema of the user running the .sql.
    I can't seem to figure out how to call the current user and then pass it to a procedure as a DEFAULT input variable. Any help would be greatly appreciated.

    OK, sadly, that did not work. What that provided to me was user that runs the procedure. If I run it as SCOTT it gives me SCOTT, but if I run as JOE, it gives me JOE.
    I created an example of what I am trying to do (it is all run in a .sql file). Let me know if this is a bad example....
    CREATE TABLE TABLE_A (
    tranid VARCHAR2(20) Primary Key,
    db_user varchar2(100) not null,
         old_val varchar2(100) not null,
    create or replace PROCEDURE TestBuild(OWN2 IN VARCHAR2, TNAME2 IN VARCHAR2, LOC2 IN VARCHAR2) IS
    OWN VARCHAR2(30);
    TNAME VARCHAR2(30);
    FNAME VARCHAR2(62);
    UNAME VARCHAR2(62);
    COL VARCHAR2(30);
    ST CHAR;
    CONS VARCHAR2(30);
    BEGIN
    OWN := UPPER(OWN2);
    TNAME := UPPER(TNAME2);
    FNAME := OWN||'.'||TNAME;
    UNAME := OWN||'_'||TNAME;
    FILE := SYS.UTL_FILE.FOPEN(LOC2,'TEST_Trig_'||UNAME||'.sql','w');
    SYS.UTL_FILE.PUT_LINE(FILE,'-- Test trigger start');
    SYS.UTL_FILE.PUT_LINE(FILE,'-- generated '||SYSDATE);
    SYS.UTL_FILE.NEW_LINE(FILE,1);
    -- The following trigger fires for EVERY row of each statement for
    -- the specified table.
    SYS.UTL_FILE.PUT_LINE(FILE,'CREATE OR REPLACE TRIGGER Test_trig_'||UNAME||' AFTER INSERT OR UPDATE OR DELETE ON '||FNAME||' ');
    SYS.UTL_FILE.PUT_LINE(FILE,' REFERENCING NEW as n OLD as o FOR EACH ROW');
    SYS.UTL_FILE.PUT_LINE(FILE,' DECLARE');
    SYS.UTL_FILE.PUT_LINE(FILE,' dmltype CHAR(1);');
    SYS.UTL_FILE.PUT_LINE(FILE,' tpid VARCHAR2(30);');
    SYS.UTL_FILE.PUT_LINE(FILE,' BEGIN');
    SYS.UTL_FILE.PUT_LINE(FILE,' tpid := SYS.DBMS_TRANSACTION.LOCAL_TRANSACTION_ID();');
    SYS.UTL_FILE.PUT_LINE(FILE,' IF INSERTING THEN dmltype := ''I'';');
    SYS.UTL_FILE.PUT_LINE(FILE,' ELSIF UPDATING THEN dmltype := ''U'';');
    SYS.UTL_FILE.PUT_LINE(FILE,' ELSIF DELETING THEN dmltype := ''D'';');
    SYS.UTL_FILE.PUT_LINE(FILE,' END IF;');
    SYS.UTL_FILE.PUT_LINE(FILE,' BEGIN');
    SYS.UTL_FILE.PUT_LINE(FILE,' INSERT INTO TABLE_A VALUES (tpid,User,:o.col1);');
    SYS.UTL_FILE.PUT_LINE(FILE,' END IF;');
    SYS.UTL_FILE.PUT_LINE(FILE,' EXCEPTION WHEN already_there THEN NULL;');
    SYS.UTL_FILE.PUT_LINE(FILE,' END;');
    SYS.UTL_FILE.PUT_LINE(FILE,' END;');
    SYS.UTL_FILE.PUT_LINE(FILE,'/');
    SYS.UTL_FILE.PUT_LINE(FILE,'show errors');
    SYS.UTL_FILE.NEW_LINE(FILE,1);
    SYS.UTL_FILE.FCLOSE_ALL;
    dbms_output.put_line('Script for table ['||FNAME||'] created. Now run it in sqlplus. ');
    END;

Maybe you are looking for

  • Can you show slideshow within Lightroom 4.4 in Adobe RGB color space?

    Can you show slideshow within Lightroom 4.4 (not export out from LR) in Adobe RGB color space provided that you are using a wide gamut monitor which is capable and hardware calibrated & profiled to show such color space? If this is possible, what is

  • Stuck with 1024x768 resolution/monitor/display

    After re-installing Snow Leopard on my friend's mac, My screen resolution/monitor/display can only get 1024x768. System Prefs doesnt allow me other display options, they are blank. Asked, Googled, people say it may be bad/corrupted video kext. Is thi

  • Making a Square book a 2pg horiz layout iPad ebook w/flip pages

    I have made a book layout in Adobe InDesign that is not your normal sized book. It is square- 10"x10" when it is closed and of course 10"x20" when open. Is it possible to make a square shaped ebook that has flip pages that will flip in a two-page vie

  • Apply fix to drivers

    Hi everyone, I hope I'm not in the wrong place for this and I hope this is not to nooby for this forum. Anyway my problem: The pressure of my Lenovo Thinkpad Yoga (Laptop/Tablet) is doing weired stuff. The harder I press, the thicker the line gets...

  • Error ORA-00928

    Hi all, I created some tables for a database that is going to be OS independent. When i put some values to a specific table, I have tha following problem: At the time that i put the values, to the table, i receive the error message "ORA-00928, SELECT