Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ALTER FUNCTION "DBA"."Wolne_samochody"()
- RETURNS INTEGER
- DETERMINISTIC
- BEGIN
- DECLARE return_name integer;
- DECLARE kursor dynamic scroll cursor for select "DBA"."Samochody"."id_statusu" from Samochody;
- DECLARE @statuss integer;
- DECLARE @ilosc integer;
- DECLARE i int;
- SET i=0;
- SET @statuss=0;
- SET @ilosc=0;
- OPEN kursor;
- while i < (SELECT count(*) from Samochody)
- LOOP
- SET i=i+1;
- FETCH NEXT kursor INTO @statuss;
- IF (statuss=2)
- THEN
- BEGIN
- SET @ilosc=@ilosc+1;
- END
- END IF;
- END LOOP;
- CLOSE kursor;
- set return_name = @ilosc;
- RETURN "return_name";
- END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement