Giter Club home page Giter Club logo

Comments (3)

PhilippSalvisberg avatar PhilippSalvisberg commented on May 26, 2024

I ran the following test on my 19c database instance:

set echo on
set serveroutput on
declare
   l_test number;
begin
   l_test := ++1;
   dbms_output.put_line(l_test);
end;
/
select ++1 from dual;

The result was:

SQL> set echo on
SQL> set serveroutput on
SQL> declare
  2     l_test number;
  3  begin
  4     l_test := ++1;
  5     dbms_output.put_line(l_test);
  6  end;
  7  /
1


PL/SQL procedure successfully completed.

SQL> select ++1 from dual;

Error starting at line : 10 in command -
select ++1 from dual
Error at Command Line : 10 Column : 9
Error report -
SQL Error: ORA-00936: missing expression
00936. 00000 -  "missing expression"
*Cause:    
*Action:

Using repeated unary operators seems to be possible for PL/SQL only. In SQL this leads to an error, which I consider good. As long as the PL/SQL parser is not able to detect this kind of errors, an additional rule makes sense.

from plsql-and-sql-coding-guidelines.

PhilippSalvisberg avatar PhilippSalvisberg commented on May 26, 2024

@silviomarghitola Is this a SonarSource rule? I could not find it.

from plsql-and-sql-coding-guidelines.

PhilippSalvisberg avatar PhilippSalvisberg commented on May 26, 2024

I checked our PL/SQL parser. This:

declare
   l_test number;
begin
   l_test := ++1;
   dbms_output.put_line(l_test);
end;
/

leads to a parse error at line 4, column 16. From my point of view this is correct. In fact I think for this case an Oracle SR should be opened instead of adding a rule and fixing the parser to support "wrong" syntax.

from plsql-and-sql-coding-guidelines.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.