Welcome Guest! Log in
×

Notice

The forum is in read only mode.
Due to some maintenance operations, stambia.org will be switched to read-only mode during the 13th November. It will be possible to read and download, but impossible to post on the forums or create new accounts. For any question please contact the support team.

Topic-icon Merged specific/Rdbms/Sybase IQ/REJECT Sybase IQ

  • Nicolas Verscheure
  • Nicolas Verscheure's Avatar Topic Author
  • Offline
More
28 Oct 2014 17:30 - 30 Oct 2014 18:09 #1 by Nicolas Verscheure
Nicolas Verscheure created the topic: specific/Rdbms/Sybase IQ/REJECT Sybase IQ
In action "insertion of rejects for AK" line 26, uses CONSTRAINT_REF instead of REF.
Here comes the correct code :

insert into %x{md:physicalPath($REF,'rejectName')}x%
(
	row_id,	
	REJECT_MODE,
	REJECT_MESSAGE,
	REJECTED_BY,
	RULE_NAME,
	RULE_TYPE,
	REJECT_DATE,
	%x{md:patternList($REF/ref:columns()[tech:isMapped()],'[colName]', ',\n\t')}x%
)
select
	rowid(CTRL),
	'%x{$REF/tech:rejectMode()}x%', 
	'%x{$CONSTRAINT_REF/tech:rejectMessage()}x%',
	'%x{$REF/tech:rejectedBy()}x%',
	'%x{$CONSTRAINT_REF/tech:name()}x%',
	'%x{$CONSTRAINT_REF/tech:constraintCode()}x%',
	%x{$REF/ref:target()/tech:dateFunction()}x%,
	%x{md:patternList($REF/ref:columns()[tech:isMapped()],'CTRL.[colName]', ',\n\t')}x%
from	%x{md:physicalPath($REF,'checkedName')}x% AS CTRL 
where	exists (
		select 	'R'
		from 	%x{md:physicalPath($REF,'checkedName')}x% TARG
		where		%x{md:patternList($REF/ref:columns()[if ($REF/tech:rejectMode()='S') then tech:isPK() else tech:isUK()],'TARG.[colName]=CTRL.[colName]', '\n\t\tand\t\t')}x%
		group by 	%x{md:patternList($CONSTRAINT_REF/ref:columns()[tech:isAk()],'TARG.[colName]', ',\n\t\t\t')}x%
		having 	count(1) > 1
)
%x{$REF/tech:filterPart()}x%
Last Edit: 30 Oct 2014 18:09 by Nicolas Verscheure. Reason: Correct title