Home » SQL & PL/SQL » SQL & PL/SQL » How can I restrict a table For only One Transaction (Oracle Sql, All Versions, Windows xp)
How can I restrict a table For only One Transaction [message #440431] Sun, 24 January 2010 15:07 Go to next message
shahidmughal
Messages: 91
Registered: January 2006
Location: Faisalabad Pakistan
Member

Hi

I hope all are fine.Dear Friends i have a requirement to restrict a table to only one transaction.
Please help me.

I have a table Named "Application_path"

Desc Application_path

app_path varchar2(256)
Images_path varchar2(256)

I don't want to allow user/users to enter more than one row in this table. There should be a single row in this table.

I will be very thankful to all of you.

Regards

Muhammad Shahid Mughal
Oracle Developer
Professional's Corner (Software Development Department)
Faisalabad Pakistan
Re: How can I restrict a table For only One Transaction [message #440433 is a reply to message #440431] Sun, 24 January 2010 15:37 Go to previous messageGo to next message
wakula
Messages: 150
Registered: February 2008
Location: Poland
Senior Member
Something like DUAL?
1. Google for the dual modification... which you should never do.
2. Maybe a trigger?
3. Maybe a check?

Why would you ever need to restrict a table to a single row?
You might use
SELECT ... FROM my_table WHERE ROWNUM<=1
.
In your case I would imagine that you wish to specify some path to something that is executed and you need to have there only 1 application. ROWNUM should do that. Trigger might notify whenever a new row is inserted (or almost to be inserted).
I believe that your application should assume that multiple rows might be present and use them in order... or notify an exception or take the oldest row only...

Good luck
Re: How can I restrict a table For only One Transaction [message #440434 is a reply to message #440433] Sun, 24 January 2010 15:51 Go to previous messageGo to next message
shahidmughal
Messages: 91
Registered: January 2006
Location: Faisalabad Pakistan
Member

Dear Friend,

Actually I only want a single record in that table.
user should not be able to enter a second record.
it is necessary.

regards

Muhammad Shahid Mughal
Oracle Developer
Faisalabad Pakistan

[Updated on: Sun, 24 January 2010 15:51]

Report message to a moderator

Re: How can I restrict a table For only One Transaction [message #440446 is a reply to message #440431] Sun, 24 January 2010 23:38 Go to previous messageGo to next message
Michel Cadot
Messages: 68722
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
Quote:
I don't want to allow user/users to enter more than one row in this table.

Quote:
Actually I only want a single record in that table.

Do not grant insert nor delete to your users.

If you do not want any modification, put the table in read-only mode.

Regards
Michel
Re: How can I restrict a table For only One Transaction [message #440628 is a reply to message #440431] Tue, 26 January 2010 05:51 Go to previous message
Kevin Meade
Messages: 2103
Registered: December 1999
Location: Connecticut USA
Senior Member
Another case of insufficient information.

shahidmughal, you need to explain why you want to do this. You need to provide more detail about how this table will be used and work. For example,

Do you want to let your users insert this one row or will you be creating it?

Do you want to let your users update the one row?

Do you want to let your users delete the one row and replace it with different one?

Do you need each user to have a different row but only one so that in effect your table can have many rows, just only one per user?

If you mean one row/user then when you say user do you really mean user or do you mean session?

What is the reason you need this table in the first place?
What process does it support?
Why is having only one row important?
What would go wrong if there was more than one row?

If you answer these questions, we will understand what you are trying to achieve and the we can give you real commentary.

Kevin x79427
Previous Topic: matrix correlation
Next Topic: The IN function
Goto Forum:
  


Current Time: Fri Dec 13 00:12:11 CST 2024