Home » Developer & Programmer » Application Express, ORDS & MOD_PLSQL » Automatically generating table ID (Application Express, Windows 7)
icon5.gif  Automatically generating table ID [message #532732] Thu, 24 November 2011 04:51 Go to next message
abarnybox
Messages: 49
Registered: November 2011
Member
Hi,

I'm very new to the world of APEX, I know a limited amount of SQL and thats about it in terms of programming...only learnt it last week...so forgive me if this is a veeery stupid question.

I have created a database in Oracle SQL Developer and I've imported it to APEX. I've created a page with a form on for one of the tables (FM_TAXI_REQUEST) which has a primary key (ID) column. Basically I want to keep that 'ID' column hidden on the page but its still a mandatory field, so how do I get APEX to automatically generate an ID Primary Key thing each time the form is filled out?

again sorry if this is easy...I have looked in the tutorial and help thing and stuff but couldn't find it.
Re: Automatically generating table ID [message #532733 is a reply to message #532732] Thu, 24 November 2011 04:56 Go to previous messageGo to next message
Littlefoot
Messages: 21806
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
I prefer use of a sequence. Apex Wizard asks you what kind of a unique identifier generator you want to use: a sequence, a trigger that already exists on a table, or to create a new trigger. As you aren't experienced in Oracle (yet), I believe that a sequence is by far the simplest solution. You'd just create it using
create sequence my_seq;
in SQL Developer and use it in Apex. The same sequence can be used for many tables (i.e. no need to create a new one for every new table's ID column).
Re: Automatically generating table ID [message #532734 is a reply to message #532732] Thu, 24 November 2011 04:58 Go to previous messageGo to next message
abarnybox
Messages: 49
Registered: November 2011
Member
also, sorry if i'm not using all the proper terminology Razz hope you actually understood what I was saying
Re: Automatically generating table ID [message #532735 is a reply to message #532734] Thu, 24 November 2011 05:01 Go to previous messageGo to next message
Littlefoot
Messages: 21806
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
I hope so. Moreover, it is true both ways (i.e. I hope you understood what I said).
Re: Automatically generating table ID [message #532736 is a reply to message #532733] Thu, 24 November 2011 05:08 Go to previous messageGo to next message
abarnybox
Messages: 49
Registered: November 2011
Member
haha thanks, i'm not 100% sure but i'll give it a go and come back to you if I don't get it Smile
Re: Automatically generating table ID [message #532737 is a reply to message #532736] Thu, 24 November 2011 05:19 Go to previous messageGo to next message
abarnybox
Messages: 49
Registered: November 2011
Member
Hi again, umm where do I create a sequence? In the wizard when it came up with the options it only had use existing sequence...then there was a list of them (I'm not the only person using the workspace and I don't think I actually have full access to it...don't know if that makes a difference) so I selected one just to see if it would work...I'm not sure it has, is there a place I can see the sequence?
Re: Automatically generating table ID [message #532738 is a reply to message #532737] Thu, 24 November 2011 05:29 Go to previous messageGo to next message
Littlefoot
Messages: 21806
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Any sequence would do.

As I said: you'd create it in SQL Developer (in your first message you said that you use it), or in SQL*Plus (a command line tool), or even in Apex itself - go to "SQL Workshop" and run the CREATE SEQUENCE statement there.

/forum/fa/9584/0/
Re: Automatically generating table ID [message #532741 is a reply to message #532737] Thu, 24 November 2011 05:40 Go to previous messageGo to next message
abarnybox
Messages: 49
Registered: November 2011
Member
ahhh ok didn't see that sorry :/

Thanks a lot seems to be working now Smile
Re: Automatically generating table ID [message #532772 is a reply to message #532732] Thu, 24 November 2011 09:51 Go to previous message
dr.s.raghunathan
Messages: 540
Registered: February 2008
Senior Member
this is the reply for the first part of your question. (whether the id column will be hidden). while creation of table people use to link the sequence with id (primary key column). If you would have done the same and on creation of page, id column will be hidden automatically and not accessable only, unless you intentionally do so.

Previous Topic: Login URL substitution
Next Topic: Help with form conditions
Goto Forum:
  


Current Time: Thu Mar 28 04:24:34 CDT 2024