/sql/Function/reports_set_copy_number.sql
http://cupsfilter.googlecode.com/ · SQL · 25 lines · 20 code · 3 blank · 2 comment · 2 complexity · 97d28e82718a230ea030d7e9ce33490f MD5 · raw file
- --DROP FUNCTION reports_set_copy_number(integer,integer);
- CREATE OR REPLACE FUNCTION reports_set_copy_number(integer,integer)
- RETURNS INTEGER AS
- $BODY$
- DECLARE
- find_id INTEGER;
- rep_id ALIAS for $1;
- field_val ALIAS for $2;
-
- BEGIN
- find_id = (SELECT id FROM reports WHERE id = rep_id);
- IF (find_id IS NULL) THEN
- INSERT INTO debug_log (inf_str) VALUES ('?????? ??????? ??????. ? ??????? reports ?? ?????????? ?????? ? ??????????? ?? ??????? cups_data_log ?????? N='||rep_id);
- RETURN 0;
- END IF;
-
- -- ???? ???????? copy number)
- UPDATE reports SET copy_number = field_val WHERE reports.id = find_id;
-
- RETURN 1;
- END;
- $BODY$
- LANGUAGE 'plpgsql' VOLATILE
- COST 100;
- ALTER FUNCTION reports_set_copy_number(integer,integer) OWNER TO postgres;