Forum Stats

  • 3,769,300 Users
  • 2,252,946 Discussions
  • 7,874,982 Comments

Discussions

Bug? Inline functions, multiple queries, and F9

user1175386
user1175386 Member Posts: 7 Blue Ribbon

Version 20.4.0.379, Windows 10, 12c database.


If I have a worksheet up, and the following two queries in that worksheet...


SELECT 2 FROM DUAL;


SELECT 3 FROM DUAL;


...I can place my cursor on/within either line, and execute the corresponding query by pressing F9.


However, if the first query includes an inline function (WITH clause invoking a PL/SQL function), SQL Developer loses the distinction between queries when I try to F9 from within either.


WITH FUNCTION f (p_n IN NUMBER) RETURN NUMBER AS BEGIN RETURN (p_n * p_n); END f;

SELECT f(2) FROM dual;


SELECT 3 FROM dual;


Now when I place my cursor within either and press F9, I get ORA-00933: SQL command not properly ended.

Best Answer

  • KayK
    KayK Member Posts: 1,685 Bronze Crown
    edited Jul 15, 2021 6:00AM Accepted Answer

    Hi 117,

    i don't know if it's bug of the sql devloper. But i expect that's an issue of SQL.

    If i copy your statement your into sql*plus it waits

    < scott:op57 > WITH FUNCTION  f (p_n IN NUMBER) RETURN NUMBER  AS  BEGIN     RETURN (p_n * p_n);  END f;
     2 SELECT f(2) FROM dual;
     3
    

    Then i type / and enter then i get the expected output.

    < scott:op57 > WITH FUNCTION  f (p_n IN NUMBER) RETURN NUMBER  AS  BEGIN     RETURN (p_n * p_n);  END f;
     2 SELECT f(2) FROM dual;
     3 /
    
         F(2)
    ----------
            4
    
    1 Zeile wurde ausgewählt.
    

    It works the same way in my SQL Dev 20.2

    regards

    Kay

    btw please choose a more readable name for your avatar. You're more than a number. Have a look at this: Update Your Community Display Name and Avatar!

Answers

  • KayK
    KayK Member Posts: 1,685 Bronze Crown
    edited Jul 15, 2021 6:00AM Accepted Answer

    Hi 117,

    i don't know if it's bug of the sql devloper. But i expect that's an issue of SQL.

    If i copy your statement your into sql*plus it waits

    < scott:op57 > WITH FUNCTION  f (p_n IN NUMBER) RETURN NUMBER  AS  BEGIN     RETURN (p_n * p_n);  END f;
     2 SELECT f(2) FROM dual;
     3
    

    Then i type / and enter then i get the expected output.

    < scott:op57 > WITH FUNCTION  f (p_n IN NUMBER) RETURN NUMBER  AS  BEGIN     RETURN (p_n * p_n);  END f;
     2 SELECT f(2) FROM dual;
     3 /
    
         F(2)
    ----------
            4
    
    1 Zeile wurde ausgewählt.
    

    It works the same way in my SQL Dev 20.2

    regards

    Kay

    btw please choose a more readable name for your avatar. You're more than a number. Have a look at this: Update Your Community Display Name and Avatar!