Plsql Analysis Error

Hi,
Perform an analysis on a file with PKB extension (PLSQL), but all I get from the review is this:

3:21:45.929 INFO: Sensor PL/SQL Sensor [plsql]
13:21:45.995 WARN: The Data Dictionary is not configured which prevents rule(s) S3641, S3921, S3618, S3651 to raise issues. See https://docs.sonarqube.org/display/PLUG/Data+Dictionary
13:21:46.011 INFO: 1 source files to be analyzed
13:21:46.093 INFO: Load project repositories
13:21:46.325 DEBUG: GET 200 https://sonarcloud.io/batch/project.protobuf?key=xxxx | time=232ms
13:21:46.335 INFO: Load project repositories (done) | time=242ms
13:21:46.335 DEBUG: 'PCK_AGE_CET_2.pkb' generated metadata with charset 'UTF-8'
13:21:47.395 INFO: ------------------------------------------------------------------------
13:21:47.395 INFO: EXECUTION FAILURE
13:21:47.395 INFO: ------------------------------------------------------------------------
13:21:47.395 INFO: Total time: 19.138s
13:21:47.557 INFO: Final Memory: 34M/484M
13:21:47.557 INFO: ------------------------------------------------------------------------
13:21:47.557 ERROR: Error during SonarQube Scanner execution
java.lang.NullPointerException
	at com.sonar.oracle.C.B.HA.Á(Unknown Source)
	at com.sonar.oracle.C.B.HA.B(Unknown Source)
	at com.sonar.oracle.Q.A(Unknown Source)
	at com.sonar.oracle.Q.A(Unknown Source)
	at com.sonar.oracle.Q.A(Unknown Source)
	at com.sonar.oracle.Q.A(Unknown Source)
	at com.sonar.oracle.Q.A(Unknown Source)
	at com.sonar.oracle.Q.A(Unknown Source)
	at com.sonar.oracle.Q.A(Unknown Source)

I thought that it was too big and I separated it into 5 parts, but one of them sends the same error (each part has around 200,000 characters), any idea of how to know where it fails or how to correct it?
I already tried with the linux and macOS version of sonar-scanner, the command is: sonar-scanner -Dsonar.projectKey = XXXX -Dsonar.organization = xxx -Dsonar.sources =. -Dsonar.host.url = https: //sonarcloud.io -Dsonar.login = xxxxxx -X

Please help, thanks!

I’m not sure if it was a copy-paste error, but to be sure, there should not be spaces around the = there, like this:

sonar-scanner -Dsonar.projectKey=XXXX -Dsonar.organization=xxx -Dsonar.sources=. -Dsonar.host.url=https: //sonarcloud.io -Dsonar.login=xxxxxx -X

Can you please confirm that you tried like this and you get the same result?

@janosgyerik Based on the stacktrace, I would say that the problem is not in the command which is used.

@Erick_Apablaza Sorry for the late reply.
There is indeed a bug in the PL/SQL analyzer. It seems that the rule S3641 “Nullable subqueries should not be used in NOT IN conditions” doesn’t handle subqueries which use two pairs of parentheses. I created SONARPLSQL-727 to track that bug.
As a workaround, you can either:

  • disable the rule S3641
  • modify the code to remove the redundant parentheses: you should have somewhere something like NOT IN ((...))

Thanks a lot for your feedback!

1 Like

Thanks @janosgyerik but the same command uses it without the PLSQL code and it works correctly, it must have been a problem in the copy and paste.

Could this source code be the error? As it was against time I took out the entire stored procedure from the package.

and   cal.cet_pco_codigo = l_cets.cet_pco_codigo                     
                and   hro.hro_codigo not in (
                             (select exa.hro_codigo
                              from   par_hro_exa exa, sre
                              where  sre.exa_cod_exa    = exa.exa_cod_exa
                              and    sre.sol_codigo     = p_sol_codigo
                              and    exa.hro_exa_no     = '1'
                              and    SRE.SRE_TEMPORAL   = p_temporal
                              and    exa.cet_pco_codigo = l_cets.cet_pco_codigo)
                             union
                             (select rie.hro_codigo
                              from   par_hro_rie rie, srr
                              where  srr.rie_cod_rie    = rie.rie_cod_rie
                              and    srr.sol_codigo     = p_sol_codigo
                              and    rie.hro_rie_no     = '1'
                              and    SRR.SRR_TEMPORAL   = p_temporal
                              and    rie.cet_pco_codigo = l_cets.cet_pco_codigo)
                                             )
                and   to_timestamp(concat(concat(cpf.cpf_fecha,' '),hro.hro_fin), 'DD-MM-YY HH24:MI') > sysdate

Yes, that part of your code triggers the bug in the PL/SQL analyzer.
I believe that you can delete the ( in (select exa.hro_codigo and the ) right before union.
Your code may contain other occurrences of the same pattern.