Re: how to compile a package from a form.

From: Playmaker <playmaker_at_iname.com>
Date: 2 Apr 2003 01:01:37 -0800
Message-ID: <459dd057.0304020101.5e0998a8_at_posting.google.com>


andrewst_at_onetel.net.uk (Tony) wrote in message news:<c0e3f26e.0303310535.76d4574b_at_posting.google.com>...
> playmaker_at_iname.com (Playmaker) wrote in message news:<459dd057.0303280446.2d56cb1a_at_posting.google.com>...
> > I have a package caled dw_test.sql, located in a unix server under the path
> > /usr/test/. Is there a way to create a button in a form that will JUST compile
> > this specific package? I don't want to run any of the procedures this package
> > contains.I would like just to compile it.
> > Neither the EXEC SQL nor the DBMS_SQL.EXECUTE commands have been proven very
> > helpfull. Any suggestions are welcomed.
> > Thank you in advance.
>
> If you just wanted to compile the package you could do this:
>
> DBMS_UTILITY.EXEC_DDL_STATEMENT('ALTER PACKAGE dw_test COMPILE');
>
> However, it sounds more like to want to CREATE OR REPLACE the package
> based on a script in a file? In that case you would need to read the
> file and build the DDL statement, then use
> DBMS_UTILITY.EXEC_DDL_STATEMENT to run that. If the file is on the
> client you can use TEXT_IO to read it; if it is on the server you can
> use UTL_FILE. In either case the logic would be similar:
>
> DECLARE
> v_file TEXT_IO.FILE_TYPE;
> v_line VARCHAR2(2000);
> v_ddl VARCHAR2(32767);
> BEGIN
> -- Open the file for read
> v_file := TEXT_IO.FOPEN( '/usr/test/dw_test.sql', 'R' );
> LOOP
> -- Get next line until EOF
> BEGIN
> TEXT_IO.GET_LINE( v_file, v_line );
> EXCEPTION
> WHEN NO_DATA_FOUND THEN
> -- EOF
> EXIT;
> END;
> -- Build DDL statement
> v_ddl := v_ddl||' '||v_line;
> END LOOP;
> TEXT_IO.FCLOSE(v_file);
> -- Run the DDL statement
> DBMS_UTILITY.EXEC_DDL_STATEMENT(v_ddl);
> END;
Yes I believe that this will do the job. Eventhough the package is pretty large (don't know if it exceeds the limit of 32767), I think that this is one possible solution. Thank you very much Tony. Best Regards. Received on Wed Apr 02 2003 - 11:01:37 CEST

Original text of this message