NonCreature0714
NonCreature0714

Reputation: 6014

PL/SQL: Row isn't inserting

I'm learning PL/SQL and I've created this procedure, which compiles; I'm not experiences enough with PL/SQL to spot where I went wrong:

Just to be clear, my question is, 'what did I do wrong?'

I'm using Datagrip and port forwarding to an OracleVM; I doubt there's a problem there, because I've inserted rows before, but this just isn't working.

CREATE OR REPLACE PROCEDURE basket_add_sp
  (
    p_basketid IN bb_basketitem.idbasket%TYPE,
    p_prodid IN bb_basketitem.idproduct%TYPE,
    p_qty IN bb_basketitem.quantity%TYPE,
    p_price IN bb_basketitem.price%TYPE,
    p_size IN bb_basketitem.option1%TYPE,
    p_form IN bb_basketitem.option2%TYPE
  )
  IS
  BEGIN
  INSERT INTO BB_BASKETITEM(idbasketitem, idproduct, quantity, price, idbasket, option1, option2)
    VALUES (bb_idBasketitem_seq.NEXTVAL, p_prodid, p_qty, p_price, p_basketid, p_size, p_form);
  COMMIT;
END;

Which completes.

[2016-07-21 21:18:28] completed in 18ms

I run the procedure:

BEGIN
  basket_add_sp(14,8,1,10.80,2,4);
END;

Also completes.

[2016-07-21 21:18:39] completed in 14ms

But when I check the table to verify, no rows are returned.

SELECT * FROM BB_BASKETITEM WHERE IDBASKETITEM = 14;

Returns this:

enter image description here

However, when I check the table, there are other rows there.

SELECT * FROM BB_BASKETITEM WHERE IDBASKETITEM = 20;

Returns this:

enter image description here

Upvotes: 1

Views: 139

Answers (1)

Peter M.
Peter M.

Reputation: 713

SELECT * FROM BB_BASKETITEM WHERE IDPRODUCT = 8;

IDBASKETITEM is a unique ID that Oracle generates by sequence when you do the insert.

Upvotes: 2

Related Questions