Home » Developer & Programmer » Application Express, ORDS & MOD_PLSQL » How to control composit Primary key in apex form (APEX 3.2)
How to control composit Primary key in apex form [message #434375] Wed, 09 December 2009 01:02 Go to next message
mahmud732
Messages: 82
Registered: October 2009
Location: Dhaka
Member
Hi all,
I have a table named salary having composit primary key(empid,sal_month). Now i have to create a form which will help me to entry staff salary into this table.
Please help me any one.

Regards


Sultan Mahmud
Re: How to control composit Primary key in apex form [message #434568 is a reply to message #434375] Wed, 09 December 2009 14:34 Go to previous messageGo to next message
andrew again
Messages: 2577
Registered: March 2000
Senior Member
http://forums.oracle.com/forums/thread.jspa?messageID=2753361&#2753361
Re: How to control composit Primary key in apex form [message #447082 is a reply to message #434375] Thu, 11 March 2010 20:46 Go to previous messageGo to next message
keywee2000
Messages: 7
Registered: March 2010
Location: Australia
Junior Member
Hi Sultan,

I have implemented the "instead of" trigger method and it does get around the problem, but if you have control over your table structures then I would suggest that by far the easiest method is to add a numeric ID column to your table, create an oracle sequence and then add a trigger to the table that populates the sequence.

It makes life much easier when working with Apex, if you conform to the way in which Apex likes to work.
Re: How to control composit Primary key in apex form [message #447119 is a reply to message #434375] Thu, 11 March 2010 23:19 Go to previous messageGo to next message
delna.sexy
Messages: 941
Registered: December 2008
Location: Surat, The Diamond City
Senior Member
Have you created this form dynamically or by using wizard?

regards,
Delna
Re: How to control composit Primary key in apex form [message #447702 is a reply to message #434375] Wed, 17 March 2010 07:44 Go to previous messageGo to next message
BBMamun
Messages: 94
Registered: February 2010
Location: Dhaka, Bangladesh
Member
Hi Sultan Mahmud you can try making a primary key column with concatenation of emp_id and salary_month, create a computation on the primary key item(which may be hidden), source type pl/sql expression and source is :emp_id||:salary_month.
Re: How to control composit Primary key in apex form [message #447721 is a reply to message #447702] Wed, 17 March 2010 09:34 Go to previous messageGo to next message
andrew again
Messages: 2577
Registered: March 2000
Senior Member
1||2345=12345
12||345=12345

Enough said.

Re: How to control composit Primary key in apex form [message #447729 is a reply to message #447721] Wed, 17 March 2010 10:30 Go to previous message
BBMamun
Messages: 94
Registered: February 2010
Location: Dhaka, Bangladesh
Member
You can do it like

-----------if type is sql----

select lpad(:emp_id,6,'0')||:salary_month
from dual;

-----------if type is pl/sql expression----

lpad(:emp_id,6,'0')||:salary_month

can be many ways....

I believe it will produce a primary key.



[Updated on: Wed, 17 March 2010 10:31]

Report message to a moderator

Previous Topic: To run a pl/sql process in Apex
Next Topic: apex 3.2 installation on oracle xe over win xp
Goto Forum:
  


Current Time: Thu Mar 28 06:42:53 CDT 2024