--- Beispiel für eine Stored Procedure in Tcl

CREATE FUNCTION isSystemUser(text) RETURNS boolean  
AS '
set userId $1
set retval false

set fd [open /etc/passwd r]
while {[gets $fd line] >=0} {
      set testId [lindex [split $line : ] 0]
      if {[string equal $testId $userId]} {
	 set retval true
	 break
      }
}
close $fd 
return $retval'

LANGUAGE 'pltclu' ;

CREATE TABLE beispiel (
       username name CHECK (isSystemUser(username))
);
