[Ur] Why won't this compile?

David Snider david at davidsnider.net
Sat Oct 20 06:38:43 EDT 2012


I can't figure out what I'm doing wrong here. The number of fields in 
the insert statement is exactly the same number in the user table.

table user : {
Id : int,
Email : string,
Password : string,
FirstName : string,
LastName : string
}
PRIMARY KEY Id

table addresstype : {
Id : int,
DisplayName : string,
Value : string
}
PRIMARY KEY Id

table address : {
Id : int,
UserId : int,
AddressTypeId : int,
Address1 : string,
Address2 : string,
City : string,
State : string,
Zip : string,
Country : string
}
PRIMARY KEY Id
CONSTRAINT FK_User FOREIGN KEY (UserId) REFERENCES user(Id) ON DELETE 
CASCADE,
CONSTRAINT FK_AddressType FOREIGN KEY (AddressTypeId) REFERENCES 
addresstype(Id) ON DELETE CASCADE

sequence userSeq

fun create email password firstname lastname  =
     id <- nextval userSeq;
     dml (INSERT INTO user (Id, Email,Password, FirstName, LastName)
      VALUES ({[id]},{[email]},{[password]},{[firstname]},{[lastname]})
     );

Error Message:

david at ubuntu:~/Projects/UrShop$ urweb urdemo
/home/david/Projects/UrShop/user.ur:37:8: (to 39:2) Length mismatch in 
INSERT field specification (5 vs. 4)
/home/david/Projects/UrShop/user.ur:37:8: (to 39:2) Length mismatch in 
INSERT field specification (5 vs. 4)
/home/david/Projects/UrShop/user.ur:37:8: (to 39:2) Length mismatch in 
INSERT field specification (5 vs. 4)
/home/david/Projects/UrShop/user.ur:37:8: (to 39:2) Length mismatch in 
INSERT field specification (5 vs. 4)
/home/david/Projects/UrShop/user.ur:37:8: (to 39:2) Length mismatch in 
INSERT field specification (5 vs. 4)
/home/david/Projects/UrShop/user.ur:37:8: (to 39:2) Length mismatch in 
INSERT field specification (5 vs. 4)
/home/david/Projects/UrShop/user.ur:37:8: (to 39:2) Length mismatch in 
INSERT field specification (5 vs. 4)
/home/david/Projects/UrShop/user.ur:37:8: (to 39:2) Length mismatch in 
INSERT field specification (5 vs. 4)
/home/david/Projects/UrShop/user.ur:37:8: (to 39:2) Length mismatch in 
INSERT field specification (5 vs. 4)
/home/david/Projects/UrShop/user.ur:37:8: (to 39:2) Length mismatch in 
INSERT field specification (5 vs. 4)
/home/david/Projects/UrShop/user.ur:37:8: (to 39:2) Length mismatch in 
INSERT field specification (5 vs. 4)
/home/david/Projects/UrShop/user.ur:37:8: (to 39:2) Length mismatch in 
INSERT field specification (5 vs. 4)
/home/david/Projects/UrShop/user.ur:37:8: (to 39:2) Length mismatch in 
INSERT field specification (5 vs. 4)
/home/david/Projects/UrShop/user.ur:37:8: (to 39:2) Length mismatch in 
INSERT field specification (5 vs. 4)
/home/david/Projects/UrShop/user.ur:37:8: (to 39:2) Length mismatch in 
INSERT field specification (5 vs. 4)
/home/david/Projects/UrShop/user.ur:37:8: (to 39:2) Length mismatch in 
INSERT field specification (5 vs. 4)
/home/david/Projects/UrShop/user.ur:37:8: (to 39:2) Length mismatch in 
INSERT field specification (5 vs. 4)
/home/david/Projects/UrShop/user.ur:37:8: (to 39:2) Length mismatch in 
INSERT field specification (5 vs. 4)
/home/david/Projects/UrShop/user.ur:37:8: (to 39:2) Length mismatch in 
INSERT field specification (5 vs. 4)
/home/david/Projects/UrShop/user.ur:37:8: (to 39:2) Length mismatch in 
INSERT field specification (5 vs. 4)
/home/david/Projects/UrShop/user.ur:37:8: (to 39:2) Length mismatch in 
INSERT field specification (5 vs. 4)
/home/david/Projects/UrShop/user.ur:37:8: (to 39:2) Length mismatch in 
INSERT field specification (5 vs. 4)
/home/david/Projects/UrShop/user.ur:37:8: (to 39:2) Length mismatch in 
INSERT field specification (5 vs. 4)
/home/david/Projects/UrShop/user.ur:37:8: (to 39:2) Length mismatch in 
INSERT field specification (5 vs. 4)
/home/david/Projects/UrShop/user.ur:37:8: (to 39:2) Length mismatch in 
INSERT field specification (5 vs. 4)
/home/david/Projects/UrShop/user.ur:37:8: (to 39:2) Length mismatch in 
INSERT field specification (5 vs. 4)
/home/david/Projects/UrShop/user.ur:37:8: (to 39:2) Length mismatch in 
INSERT field specification (5 vs. 4)
/home/david/Projects/UrShop/user.ur:37:8: (to 39:2) Length mismatch in 
INSERT field specification (5 vs. 4)
/home/david/Projects/UrShop/user.ur:41:0: (to 41:0) syntax error found 
at EOF
Parse failure





More information about the Ur mailing list