Home » SQL & PL/SQL » SQL & PL/SQL » Help Required (Oracle 9i , Windows xp)
Help Required [message #320914] Fri, 16 May 2008 13:18 Go to next message
myorabhi
Messages: 10
Registered: May 2008
Junior Member
I have a table known as service table having 8 attributes, one of them is S_ID , now i want that whenever this query is fired the values like s1,s2,s3,s4 .... and so on should be entered in to the table, i must not have to specify it. Is this possible in sql. Kindly reply soon
Thanks in advance. Razz
Re: Help Required [message #320916 is a reply to message #320914] Fri, 16 May 2008 13:29 Go to previous messageGo to next message
Michel Cadot
Messages: 64144
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Quote:
i want that whenever this query is fired

Which one?

Quote:
the values like s1,s2,s3,s4 .... and so on should be entered in to the table,

Where?

Quote:
i must not have to specify it

So how to know what must be "entered"?

In short, what you posted is not clear.

Regards
Michel
Re: Help Required [message #320917 is a reply to message #320914] Fri, 16 May 2008 13:33 Go to previous messageGo to next message
myorabhi
Messages: 10
Registered: May 2008
Junior Member
actually i have a website ,on a click event , all the attributes along with S_ID is inserted into the table which is services, so everytime i must not enter the S_ID field. so is there any solution for it.
Re: Help Required [message #320920 is a reply to message #320917] Fri, 16 May 2008 13:46 Go to previous messageGo to next message
Michel Cadot
Messages: 64144
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
insert or update?
Post a step by step example that we can understand.

Regards
Michel

Re: Help Required [message #320922 is a reply to message #320914] Fri, 16 May 2008 13:49 Go to previous messageGo to next message
myorabhi
Messages: 10
Registered: May 2008
Junior Member
insert

each time i have to insert a new record , and i want that S_ID field must be filled automatically with other atttributes.
i dont have to insert manually S_ID = something.

i guess u understood the problem
Re: Help Required [message #320923 is a reply to message #320914] Fri, 16 May 2008 14:13 Go to previous messageGo to next message
flyboy
Messages: 1832
Registered: November 2006
Senior Member
> i guess u understood the problem
Maybe "u" was sitting behind your back, but nobody in this forum is.

> must be filled automatically with other atttributes.
Maybe there is rule for obtaining its value, but you did not include it into your post. Do you think it is not important?

> i dont have to insert manually S_ID = something.
Is it a question or statement?

> Post a step by step example that we can understand.
I am afraid that without posting simple testcase, nobody here will understand.
Re: Help Required [message #320929 is a reply to message #320914] Fri, 16 May 2008 15:06 Go to previous messageGo to next message
myorabhi
Messages: 10
Registered: May 2008
Junior Member
i have a table like this shown in the image
  • Attachment: asa.JPG
    (Size: 111.41KB, Downloaded 105 times)
Re: Help Required [message #320930 is a reply to message #320914] Fri, 16 May 2008 15:11 Go to previous messageGo to next message
myorabhi
Messages: 10
Registered: May 2008
Junior Member
here in the S_ID field , i want to insert values like s1,s2,s2,s4.....and so on.

whenever any click event occurs a query is fired , which inserts the values of all attributes. here i have to insert S_ID manually. i want that this value should automatically be inserted into the S_ID field whenever this submit(click event )
occurs. here is the form of the website.
Re: Help Required [message #320931 is a reply to message #320929] Fri, 16 May 2008 15:23 Go to previous messageGo to next message
Michel Cadot
Messages: 64144
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Why don't you just copy and paste the text instead of printing the whole screen? It is better for a forum.

Regards
Michel
Re: Help Required [message #320932 is a reply to message #320930] Fri, 16 May 2008 15:23 Go to previous messageGo to next message
Michel Cadot
Messages: 64144
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Quote:
here i have to insert S_ID manually. i want that this value should automatically be inserted into the S_ID field whenever this submit

Which value? 0? -1? 999999999? AAAAA? Michel? myorabhi? Obi-Wan Kenobi?

Regards
Michel

[Updated on: Fri, 16 May 2008 15:26]

Report message to a moderator

Re: Help Required [message #320933 is a reply to message #320914] Fri, 16 May 2008 15:31 Go to previous messageGo to next message
myorabhi
Messages: 10
Registered: May 2008
Junior Member
for the first time s1
second time s2

that is

i have to insert

s along with the numbers

s1,s2,s3 as i have shown in the example given in the table in S_-ID field
Re: Help Required [message #320935 is a reply to message #320914] Fri, 16 May 2008 15:32 Go to previous messageGo to next message
myorabhi
Messages: 10
Registered: May 2008
Junior Member
S_ID field contains both numeric as well as text.
s1,s2,s3,s4......
Re: Help Required [message #320936 is a reply to message #320914] Fri, 16 May 2008 15:43 Go to previous messageGo to next message
BlackSwan
Messages: 25049
Registered: January 2009
Location: SoCal
Senior Member
myorabhi,

http://www.orafaq.com/forum/t/88153/0/
Please read & follow posting guidelines as stated in URL above

what EXACTLY would you like to have posted here to assist you?

I, for one, do not understand what you expect/desire from us.
Re: Help Required [message #320938 is a reply to message #320935] Fri, 16 May 2008 15:44 Go to previous messageGo to next message
Michel Cadot
Messages: 64144
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Have a look at sequence and trigger and some applications like "Automatically generate derived column values".

Regards
Michel
Re: Help Required [message #320942 is a reply to message #320914] Fri, 16 May 2008 16:32 Go to previous messageGo to next message
myorabhi
Messages: 10
Registered: May 2008
Junior Member
Thanks a lot Micheal.
I have got it.

One more final question , can we add varchar values in squence command.
Re: Help Required [message #320960 is a reply to message #320942] Sat, 17 May 2008 00:50 Go to previous messageGo to next message
Michel Cadot
Messages: 64144
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
No, you have to do it yourself in the trigger.

Regards
Michel
Re: Help Required [message #320982 is a reply to message #320960] Sat, 17 May 2008 05:15 Go to previous messageGo to next message
Littlefoot
Messages: 20901
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
But, why would you store "s" along with the number sequence? So that you'd know that s44325 belongs to S_ID column? Could you, instead of a VARCHAR2 column, use NUMBER column and fill it with a SEQUENCE?
Re: Help Required [message #320983 is a reply to message #320914] Sat, 17 May 2008 05:22 Go to previous messageGo to next message
myorabhi
Messages: 10
Registered: May 2008
Junior Member
same as in this table i have another tables where i have to place a "c" before the numbers. c1,c2,c3 ....

so here also the same concept will apply.

through this i could know that a number belongs to which table.
Re: Help Required [message #320984 is a reply to message #320914] Sat, 17 May 2008 05:23 Go to previous messageGo to next message
myorabhi
Messages: 10
Registered: May 2008
Junior Member
yes littlefoot , you got it, i want to recognise whether a number belongs to which table.
Re: Help Required [message #320987 is a reply to message #320984] Sat, 17 May 2008 06:56 Go to previous message
Frank
Messages: 7880
Registered: March 2000
Senior Member
If you are so determined to know from which table the id stems, you should either prefix it with the correct letter during SELECT or create a view that does that for you.
Previous Topic: Need Answer
Next Topic: SQL & PL/SQL compared against JDBC / ODBC
Goto Forum:
  


Current Time: Fri Dec 09 11:26:39 CST 2016

Total time taken to generate the page: 0.10355 seconds