DBAsupport.com Forums - Powered by vBulletin
Results 1 to 5 of 5

Thread: help with this very simple proc?

  1. #1
    Join Date
    Aug 2000
    Location
    Alberta
    Posts
    82

    Unhappy help with this very simple proc?

    I am trying to write a simple proc to call from an access form to populate a table with random entries. It is as follows:
    =========================
    declare

    num1 number;

    begin
    insert into table2
    select * from (select col1,col2 from
    table1 where col3 is not null
    order by dbms_random.value) where rownum <= %num1;

    end;

    ===========================

    It runs fine from sqlplus with an "SQL:>@procedure", but wont run if I enter "SQL:>exec procedure" nor will it compile.
    As you can see I havent spent a lot of time in PL/SQL - can anyone help here?

    TIA
    Glen A. S.

  2. #2
    Join Date
    Jun 2000
    Location
    Madrid, Spain
    Posts
    7,447
    that is not a procedure ok!

    that is called anonymous pl/sql block

    go tahiti.oracle.com and read some manuals oke!

  3. #3
    Join Date
    Aug 2000
    Location
    Alberta
    Posts
    82
    Sorry - I should have incuded the full text, it is indeed a procedure, or at least my attempt at one. I was creating it in DBA studio and I just pasted the body of it in to a .sql file and ran it from there to test it, where it ran fine.

    The DDL for it does have the "create or replace procedure ", I just forgot to include it in the original post.

    GS
    Glen A. S.

  4. #4
    Join Date
    Oct 2002
    Posts
    12
    DBMS_RANDOM.VALUE??????????

    It's very new to me.

    What version of Oracle u have?


    Raja.M

    [email protected]

  5. #5
    Join Date
    Aug 2000
    Location
    Alberta
    Posts
    82
    8.1.7.4

    DBMS_RANDOM has been available since 8.x I believe - I use it in this particular case to populate a table with x number of random picked records from a larger table. It works quite well.
    Glen A. S.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width