While using Catalyst to insert a book record, error occurs. After searching info from google, no solution is found. Would you pls offer some advice ? Here is the controller's code.
sub url_create : Local { # In addition to self & context, get the title, rating, & # author_id args from the URL. Note that Catalyst automatical +ly # puts extra information after the "/<controller_name>/<action +_name/" # into @_ my ($self, $c, $title, $rating, $author_id) = @_; # Call create() on the book model object. Pass the table # columns/field values we want to set as hash values my $book = $c->model('DB::Books')->create({ title => $title, rating => $rating }); # Add a record to the join table for this book, mapping to # appropriate author $book->add_to_book_authors({author_id => $author_id}); # Note: Above is a shortcut for this: # $book->create_related('book_authors', {author_id => $author_ +id}); # Assign the Book object to the stash for display in the view $c->stash->{book} = $book; # This is a hack to disable XSUB processing in Data::Dumper # (it's used in the view). This is a work-around for a bug in # the interaction of some versions or Perl, Data::Dumper & DBI +C. # You won't need this if you aren't using Data::Dumper (or if # you are running DBIC 0.06001 or greater), but adding it does +n't # hurt anything either. $Data::Dumper::Useperl = 1; # Set the TT template to use $c->stash->{template} = 'books/create_done.tt2'; }
However, after accessing URL "http://localhost:3000/books/url_create/TCPIP_Illustrated_Vol-2/5/4", error shows up as :
INSERT INTO books (rating, title) VALUES (?, ?): '5', 'TCPIP_Illustrat +ed_Vol-2' SELECT COUNT( * ) FROM books me: SELECT COUNT( * ) FROM books me: [info] *** Request 1 (0.038/s) [5225] [Thu Aug 14 15:29:27 2008] *** [debug] "GET" request for "books/url_create/TCPIP_Illustrated_Vol-2/5/ +4" from "202.38.40.128" [debug] Path is "books/url_create" [debug] Arguments are "TCPIP_Illustrated_Vol-2/5/4" [error] DBI Exception: DBD::Oracle::st execute failed: ORA-01400: cann +ot insert NULL into ("SDB2"."BOOKS"."ID") (DBD ERROR: OCIStmtExecute) + [for Statement "INSERT INTO books (rating, title) VALUES (?, ?)" wit +h ParamValues: :p1='5', :p2='TCPIP_Illustrated_Vol-2'] at /usr/local/ +lib/perl5/site_perl/5.10.0/DBIx/Class/Schema.pm line 954

In reply to Error while using Catalyst to insert record to Oracle by marscld

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.