Path: utzoo!mnetor!uunet!husc6!ut-sally!ut-emx!lad-shrike!chris From: chris@AUSTIN.LOCKHEED.COM (Chris Wood) Newsgroups: comp.databases Subject: Re: Informix query Message-ID: <60@coot.AUSTIN.LOCKHEED.COM> Date: 4 Jan 88 15:16:24 GMT References: <3072@ihlpf.ATT.COM> <3890001@hpcmmb.HP.COM> <3216@ihlpf.ATT.COM> Organization: Lockheed Austin Div. Lines: 44 Summary: How do you sequentially examine records using SQL? In article <3216@ihlpf.ATT.COM>, lukas@ihlpf.ATT.COM (00704a-Lukas) writes: > 4) Difficulty (outside of perform) of doing that most basic of > database applications: that of cycling through the rows, adding, > deleting, modifying as you go. I would like to know how to go about this also. I am using ORACLE and would like to do this. I used to do something like the following in MODEL 204: 1. Find customers where qty-ordered > 1000 2. For each record in 1 2.1 If customer.area = "NORTHEAST" then 2.1.1 update region set good-customers = good-customers + 1 2.2 find orders where orders.custno = customers.number 2.3 for each record in 2.2 2.3.1 ... add up the total orders for that customer and store them back into that customers record... . . . Is there some underlying mathematical "relational purist" reason why such procedural constructs are lacking in relational implementations? The above looping code is very easy to develop and understand (at least for me) compared to the shenanigans I have to go through to do something like this in a SQL based system. How about something like: Select * from customer where customer.qty-ordered > 1000 into junk for each record in junk DO . . . . End DO (WOW Shades of FORTRAN) Why Can't relational systems do this? Or better yet, is there a SQL/Relational system out there that does?