Home » SQL & PL/SQL » SQL & PL/SQL » Update using sample(1)
Update using sample(1) [message #428799] Fri, 30 October 2009 02:23 Go to next message
carillpower
Messages: 48
Registered: April 2009
Location: malaysia
Member

Hi all, i got doubt here...i can use this method for select..like this

select distinct first_nam 
from (select first_nam from test1 sample(1))
where rownum = 1;



But when i use it for update statement, its shows this error...


SQL> update test1 set first_nam = (initcap('ali') || ' ' || initcap('abu'))
  2  where first_nam = (select distinct first_nam
  3  from (select first_nam from test1 sample(1))
  4  where rownum = 1)
  5  and employee_id = '000000';
from (select first_nam from test1 sample(1))
                                        *
ERROR at line 3:
ORA-00907: missing right parenthesis



Kindly advise me on what should be the proper way to do it...thanks
Re: Update using sample(1) [message #428802 is a reply to message #428799] Fri, 30 October 2009 02:33 Go to previous message
lancer26
Messages: 52
Registered: May 2006
Location: Pakistan
Member

try this

from (select first_nam from test1) sample(1)
Previous Topic: ora-29283 invalid file operation
Next Topic: start stop rowcount in query
Goto Forum:
  


Current Time: Sun Dec 11 04:15:58 CST 2016

Total time taken to generate the page: 0.10806 seconds