Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6346151
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T20:57:45+00:00 2026-05-24T20:57:45+00:00

I have a sequence named WCOMP_SEQ in oracle to generate auto increment column ON

  • 0

I have a sequence named WCOMP_SEQ in oracle to generate auto increment column ON WCOMP table. When I insert a row to WCOMP table in SQLPlus, the row inserted and I can get the auto increment value using

SELECT WCOMP_SEQ.currval FROM dual

But when I ran insert a row using Database Class in CodeIgniter, the row inserted but when I ran the query above to get auto increment value I got Exception:

Exception: Undefined Index currval in E:...

How to fix this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T20:57:45+00:00Added an answer on May 24, 2026 at 8:57 pm

    There is a way to get the value automatically assigned to a column: it is the RETURNING clause.

    So, here is my sequence:

    SQL> select emp_seq.currval from dual
      2  /
    
       CURRVAL
    ----------
          8140
    
    SQL>
    

    I’m going to use it in an INSERT statement:

    SQL> var seqval number
    SQL> insert into emp
      2  (empno, ename, deptno, sal, job)
      3  values
      4      (emp_seq.nextval, 'JELLEMA', 50, 4575, 'PAINTER')
      5  returning empno into :seqval
      6  /
    
    1 row created.
    
    SQL>
    

    I returned the EMPNO into a SQL*Plus variable which I can print, and it has the same value as CURRVAL:

    SQL> print :seqval
    
        SEQVAL
    ----------
          8141
    
    SQL> select emp_seq.currval from dual
      2  /
    
       CURRVAL
    ----------
          8141
    
    SQL>
    

    Your next question is, “does CodeIgniter support the RETURNING sysntax?” I have no idea, but I suspect it does not. Most non-Oracle frameworks don’t.

    There is always the option to wrap the INSERT statement in a stored procedure, but that’s an architectural decision whoch many people dislike.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a 2-column table named Assignment . The table contains assignment of Person
I have an issue, I'm trying to insert a new row into a postgres
I am developing an application using oracle 11g, Java(struts2) and Hibernate. I have table
I have a sequence table with two columns, name, value, and I have a
I would like to force the auto increment field of a table to some
I have a table named 'Logs' with the following values : CheckDate CheckType CheckTime
I use hibernate with oracle . hibernate_sequence table have duplicate entries for few sequence_name
I have some code: @Id @SequenceGenerator(name = SOMETHING_SEQ) @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = SOMETHING_SEQ)
If I have sequence of sequences (maybe a list of tuples) I can use
I have a sequence of migrations in a rails app which includes the following

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.