db inserts not working

Philip Greenspun's Homepage : Philip Greenspun's Homepage Discussion Forums : 6916 : One Thread
Notify me of new responses
I realized while working on Exercise 11 that my sql insert statement
is failing to execute. I've been trying to look at it forever, it
just starts a transaction but "hangs" on it I guess. I then realized
that I am using the same kind of procedures as is used in
quotation-add.tcl, which worked a couple of days ago and to which I
have made no changes. Now, all of a sudden it doesn't work. Is there
some configuration of the db that needs to be restarted for pages that
worked a while ago to once again work?

The text it is hanging on goes something like:

set db [ns_db gethandle]
ns_db dml $db "begin transaction"
ns_db dml $db "insert into quotations(quotation_id, insertion_date,
author_name, category, quote) values ($new_key, sysdate,
'$new_author_name', '$new_category', '$new_quote')"

All these variables are definitely defined. Please let me know if
there's any reason that something that worked a couple days ago could
possibly not work now. I have tried restarting aolserver.


-- Ken McCracken, September 22, 1999


Are you executing an "end transaction"?

A begin transaction statement tells Oracle that the next set of statements should be atomic, and an end transaction tells Oracle where the end of that set of statements is...so if you don't have an end transaction, Oracle will just sit there.

In general, you don't need begin transaction unless you need atomicity across multiple statements. If you're doing a single insert, you don't need it, since each statement is atomic itself.

-- Richard Li, September 22, 1999