ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dick, Brian E." <Brian.D...@FMR.com>
Subject RE: Problems Using PLSQL In Ant SqlTask
Date Fri, 10 Sep 2004 18:46:54 GMT
I use the exec task and SqlPlus to execute my PL/Sql, but another poster (Jérôme Grelier
[jgrelier@octo.com]) claims that the following works to compile packages. Maybe you will find
something useful in this code.

However, JDBC is not SqlPlus, so commands specific to SqlPlus (e.g. @) will definitely not
work.


<target name="compilepackage">
 <sql driver="oracle.jdbc.driver.OracleDriver"
	url="${db.url}"
	userid="${db.user}"
	password="${db.password}"
	onerror="abort"
	delimitertype="row"
	delimiter="/"
	keepformat="yes"
	classpath="${jdbc.jar}">	
	
	<transaction src="${src.dir}/${packagedir}/${packagename}.pks"/>
	<transaction>
			BEGIN
			
			DECLARE
			NUM INTEGER;
			ERROR_TEXT USER_ERRORS.TEXT%TYPE;
			
			BEGIN
			
			SELECT Count(*) INTO NUM FROM USER_ERRORS WHERE Type
= 'PACKAGE' AND NAME = '${packagename}';
			
			If num > 0 Then
			SELECT TEXT INTO ERROR_TEXT FROM USER_ERRORS WHERE
Type = 'PACKAGE' AND NAME = '${packagename}';
			RAISE_APPLICATION_ERROR(-20000, ERROR_TEXT, True);
			End IF;
			
			END;

			END;
	</transaction>
	<transaction src="${src.dir}/${packagedir}/${packagename}.pkb"/>

	<transaction>
			BEGIN
			
			DECLARE
			NUM INTEGER;
			ERROR_TEXT USER_ERRORS.TEXT%TYPE;
			
			BEGIN
			
			SELECT Count(*) INTO NUM FROM USER_ERRORS WHERE Type
= 'PACKAGE BODY' AND NAME = '${packagename}';
			
			If num > 0 Then
			SELECT TEXT INTO ERROR_TEXT FROM USER_ERRORS WHERE
Type = 'PACKAGE BODY' AND NAME = '${packagename}' AND ROWNUM = 1;
			RAISE_APPLICATION_ERROR(-20000, ERROR_TEXT, True);
			End IF;
			
			END;
			
			END;
	</transaction>		
	</sql>	
  </target>

-----Original Message-----
From: Anthony Bisong [mailto:abisong@yahoo.com] 
Sent: Friday, September 10, 2004 10:57 AM
To: Ant Users List
Subject: Problems Using PLSQL In Ant SqlTask


I am having problems running oracle PL/Sql in the ant sql task.  Also it seems the sql task
does
not like the following sql commands: @, declare, begin.  Has anyone been able to get PL/Sql
and
the sql commands:  @, declare, begin to work in the sql task?

=====
Anthony Bisong
CELL: 770-827-5941
abisong@yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message