Update random rows in a table [message #457499] |
Mon, 24 May 2010 20:40 |
h_jitendras
Messages: 36 Registered: October 2006
|
Member |
|
|
Hi,
I have this requirement in Oracle FORMS ver 6i where I populate some records in a table in a datablock and display them on the screen. A facility needs to be provided to the end users to select the records randomly by just entering the count of the records in a non-d/b text field. The number entered in the count field will decide how many records are to be selected randomly.
I tried using the query -
UPDATE <table a>
SET <col 1> = <value 1>
WHERE rowid IN (SELECT rowid FROM (SELECT * FROM <table a> ORDER BY DBMS_RANDOM.VALUE)
WHERE <col 2> = <value 2>)
/
which I found on the link http://forums.oracle.com/forums/thread.jspa?threadID=625395
but while compiling, the Form gives a compilation error for the ORDER by clause - i'm sure there's no syntax error in the way I have written it...
Any suggestions?
|
|
|
|
|
Re: Update random rows in a table [message #458031 is a reply to message #457521] |
Wed, 26 May 2010 20:45 |
h_jitendras
Messages: 36 Registered: October 2006
|
Member |
|
|
Thanks once again littlefoot... i did put this code snippet in a procedure ..a program unit and it worked.
Sometimes with FORMS, it amazes me why the code didnt work as it is and had to be called from a procedure instead?
Thanks all for your suggestions and your help.
|
|
|
|
|