简体   繁体   中英

Manual testing a stateless function in oracle sql in SQL developer

I've coded the most complex sql function ever:

function abc() RETURN 7;

I'd like to verify my function actually does what I think it does : to return a 7.

What's the easiest way to accomplish that with sql-developer?

function abc() RETURN 7; This is not a valid declaration of a function.

Let's try something like this:

SQL> create or replace function abc
  2  return number
  3  is
  4  begin
  5    return 7;
  6  end;
  7  /

Function created

To see result of the function just query dual table with the function name being listed in the select part of a query. Using this method be sure that the function does not contain any DML statements.

SQL> 
SQL> select abc
  2    from dual
  3  /

       ABC
----------
         7

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM