Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> newbie passing parameters from Web page to Stored Procedure

newbie passing parameters from Web page to Stored Procedure

From: <shall_at_uaex.edu>
Date: 30 Sep 2006 15:44:25 -0700
Message-ID: <1159656265.794287.304650@k70g2000cwa.googlegroups.com>


I'm trying to pass "20060821" as myUserID from a web page. The problem is that it does NOT find any records.

 I think it is in my First SQL statement.

What I'm trying eventually to do is to LOCK QTY on hand and subtract the amount the customer ordered. Example QTY on HAND is 100 and user orders 5. I want to lock the QTY and replace it with 95 then unlock it.
I'm using Oracle 9i.



CREATE OR REPLACE PACKAGE pkgpending AS

        Procedure open_join_cursor1 (myUserID IN VARCHAR2); END pkgpending;
/

CREATE OR REPLACE PACKAGE BODY pkgpending IS

	CURSOR io_cursor
	IS
		select P.sessionid,P.itemnumber,M.Ndesclow
		,P.person,M.Qty,P.Origqty ,P.Qty AS MMQty
		FROM pending P, pub M
		WHERE ( P.Sessionid LIKE 'myUserID'
		AND P.Itemnumber=M.Itemnumber)
		 for update of M.qty,M.Ndesclow;

  ao_rec io_cursor%ROWTYPE;

Procedure open_join_cursor1 (myUserID IN VARCHAR2) IS

	myqty 		pub.qty%TYPE:=1;
	newqty 		pub.qty%TYPE;
	Itemnumber      pub.Itemnumber%TYPE;
	MMqty 		pub.qty%TYPE;
                 hiqty           pub.qty%TYPE;
	origqty 	pub.qty%TYPE:=0;
	lcItemnum	VARCHAR2(100);
	lc2Out          VARCHAR2(100);
	lnNEMPNO        NUMBER;
BEGIN
	OPEN io_cursor;
	lc2Out :='ABCDE';
	LOOP
	FETCH io_cursor INTO ao_rec;
	EXIT WHEN io_cursor%NOTFOUND;
		lnNEMPNO := MMQty;
		lcItemnum := Itemnumber;
		hiqty := ao_rec.qty;
		newqty:=ao_rec.qty-lnNEMPNO;
		IF newqty>=0 THEN
			update pub set qty=newqty
			,ndesclow=lc2Out
			where ( itemnumber like 'lcItemnum');
		END IF;
		commit;
	END LOOP;

END open_join_cursor1;
END pkgpending;
/


TIA
Steve Received on Sat Sep 30 2006 - 17:44:25 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US