DROP TABLE TEST /
CREATE TABLE TEST (
	ID INTEGER NOT NULL PRIMARY KEY, 
	NAME VARCHAR(80), 
	KIND CHAR(1), 
	PRICE NUMBER(10,2), 
	UPDATE_TIME TIMESTAMP) /

INSERT INTO TEST VALUES(1001, 'NAME 1001', '1', 1001.01, TO_TIMESTAMP('2009-01-01', 'YYYY-MM-DD')) /
INSERT INTO TEST VALUES(1002, 'NAME 1002', '2', 1002.02, TO_TIMESTAMP('2009-02-02', 'YYYY-MM-DD')) /
INSERT INTO TEST VALUES(1003, 'NAME 1003', '3', 1003.03, TO_TIMESTAMP('2009-03-03', 'YYYY-MM-DD')) /
INSERT INTO TEST VALUES(1004, 'NAME 1004', '4', 1004.04, TO_TIMESTAMP('2009-04-04', 'YYYY-MM-DD')) /
INSERT INTO TEST VALUES(1005, 'NAME 1005', '5', 1005.05, TO_TIMESTAMP('2009-05-05', 'YYYY-MM-DD')) /

DROP TABLE TESTB /
CREATE TABLE TESTB (
	ID INTEGER NOT NULL PRIMARY KEY, 
	DATA BLOB) /

CREATE OR REPLACE FUNCTION GET_TEST_PRICE(vid IN INTEGER) RETURN NUMBER IS
	vprice NUMBER(10,2);
BEGIN
	SELECT PRICE INTO vprice FROM TEST WHERE ID=vid;
	RETURN(vprice);
END;
/

CREATE OR REPLACE FUNCTION SET_TEST_PRICE(vid IN INTEGER, vprice IN OUT NUMBER) RETURN NUMBER IS 
	vcount INTEGER;
	rprice NUMBER(10,2);
BEGIN
	SELECT COUNT(*) INTO vcount FROM TEST WHERE ID=vid;
	SELECT PRICE INTO rprice FROM TEST WHERE ID=vid;
	UPDATE TEST SET PRICE=vprice WHERE ID=vid;
	vprice := rprice;
	RETURN(vcount);
END;
/
