Results 1 to 13 of 13

Thread: Stupid question

  1. #1
    Join Date
    Dec 2004
    Posts
    43

    Unanswered: Stupid questions

    Sorry for stupid question and for my poor english, but how i can to find a sin(5) ?
    In postgres i just type 'select sin(5)', but in DB2 it doesnt work :-((
    Last edited by nelapsi; 12-09-04 at 06:42.

  2. #2
    Join Date
    Oct 2004
    Posts
    4
    Try

    Code:
    select sin(5) from sysibm.sysdummy1

  3. #3
    Join Date
    Dec 2004
    Posts
    43
    Quote Originally Posted by okman
    Try

    Code:
    select sin(5) from sysibm.sysdummy1
    thanks
    can you say, how i can select nextval from sequence:?

  4. #4
    Join Date
    Aug 2004
    Posts
    330
    Be aware that the DB2 sine function is the sine of an angle expressed in RADIANS.

  5. #5
    Join Date
    Mar 2004
    Posts
    448
    db2 "values nextval for <sequence_name>"

    You can also use

    db2 "select nextval for test_seq from sysibm.sysdummy1"

    regards

    Mujeeb

  6. #6
    Join Date
    Dec 2004
    Posts
    43
    Quote Originally Posted by okman
    Try

    Code:
    select sin(5) from sysibm.sysdummy1
    i've found more simple method :
    values(sin(5))
    $)

  7. #7
    Join Date
    Aug 2004
    Posts
    330
    Or even more simply -0.95892427466313846889315440615599 and bypass the DBMS altogether.

  8. #8
    Join Date
    Dec 2004
    Posts
    43

    Another stupid question :)

    How can I get in seconds time elapsed since 1970 year?

  9. #9
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    We've had this discussion before:
    http://www.dbforums.com/t1004639.html

  10. #10
    Join Date
    Dec 2004
    Posts
    43

    another stupid question

    please someone give an example of function (in sql) with "select into" statement....
    I newbie in DB2 and I try this
    Code:
    create function tf() returns integer
    language sql
    not deterministic
    no external action
    begin atomic
        declare iii integer default 7;
        select id into iii from tt;
        return iii;
    end@
    Code:
    but I have error :SQL0104N  An unexpected token "iii" was found following ";     select id
    into".  Expected tokens may include:  "<space>".  LINE NUMBER=7.
    SQLSTATE=42601

  11. #11
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    Try:

    create function tf() returns integer
    language sql
    not deterministic
    no external action
    begin atomic
    declare iii integer default 7;
    set (iii) = (select id from tt);
    return iii;
    end@

    Andy

  12. #12
    Join Date
    Dec 2004
    Posts
    43

    Help!

    please, smb, give an example of procedure (in sql) with out parameter and with calling of another stored procedures
    I've tried this
    Code:
    CREATE PROCEDURE tp(ss varchar(100), out ret integer)
    language sql
    begin
        set (ret) = (select id from tt);
        insert into tt1 values(12, ss);
    end@
    and take an error...
    and another question.
    can I use an user defined type in pocedures?

  13. #13
    Join Date
    Dec 2004
    Posts
    43

    call procedure from procedure

    Why this procedure
    Code:
    CREATE PROCEDURE UTIL.CREATE_USER (u_login varchar(100), pass varchar(100), u_email varchar(100), comm varchar(100), person integer, uuser integer)
    LANGUAGE SQL
    begin atomic
        declare ret integer;
        select max(id) + 1 into ret from UTIL.Users;
        insert into UTIL.Users values (ret, u_login, pass, u_email, comm, nullif(person,0), 0);
        call util.set_user_right ('UTIL', 'Users', ret, uuser, 31);
    
    end@
    generates an error:
    Code:
    SQL0104N  An unexpected token "''UTIL'', ''Users''" was found following
    "til.set_user_right (".  Expected tokens may include:  "<psm_var_list_input>".
    LINE NUMBER=9.  SQLSTATE=42601

Posting Permissions

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