Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 847
  • Last Modified:

PL/SQL: ora-06550 pls-00103

i have this code
DECLARE
tiempo_comienzo CHAR(5);
tiempo_fin CHAR(5);
tiempo_transcurrido NUMBER(5);

BEGIN

/* Obtenemos la hora del sistema como segundos */
SELECT TO_CHAR(SYSDATE,'SSSSS') INTO tiempo_comienzo
FROM sys.dual;

/* Volvemos a obtenerla */
SELECT TO_CHAR(SYSDATE,'SSSSS') INTO tiempo_fin
FROM sys.dual;

/* Calculamos el tiempo transcurrido en segundos */
tiempo_transcurrido := tiempo_fin – tiempo_comienzo;

END;

i have attached the error, view image please


ora-06550-pls-00103.jpg
0
enrique_aeo
Asked:
enrique_aeo
  • 3
  • 3
  • 2
  • +2
4 Solutions
 
johanntagleCommented:
I think its because you are trying to do subtraction on CHAR variables.  Suggest you make them numbers then change your select to SELECT TO_NUMBER(TO_CHAR(SYSDATE,'SSSSS'))
0
 
ajexpertCommented:
I do not understand the business of writing your code as both are comparing against SYSDATE

Technically, the other way of writing is
tiempo_transcurrido := TO_NUMBER(tiempo_fin) – TO_NUMBER(tiempo_comienzo);

Open in new window

0
 
enrique_aeoAuthor Commented:
I'm testing the implicit conversion, do not understand why it does not work, if anything can help me with an example thanks
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
ajexpertCommented:
Yes, you are right, implict conversion should work.

Can you please try the same code in SQLPLUS and see if is going through?
0
 
Shaju KumbalathDeputy General Manager - ITCommented:
tiempo_transcurrido := tiempo_fin – tiempo_comienzo;

rewrite the '-' sign

it is chr(150) instead of chr(45)
0
 
awking00Commented:
What are you using as your minus sign? If you do a dump, it shows the <space-minus sign-space> sequence as chr(32),chr(32) and doesn't recognize the minus sign.
0
 
enrique_aeoAuthor Commented:
this is the example (from a book)
conversion-implicita.jpg
0
 
Shaju KumbalathDeputy General Manager - ITCommented:
tiempo_transcurrido := tiempo_fin – tiempo_comienzo;

where the character '-'  is not minus sign

please rewrite the above code if u have copied it from the example
0
 
Shaju KumbalathDeputy General Manager - ITCommented:
i got the same error when i copied ur code and i just removed '-' sign and added it again. it worked
0
 
awking00Commented:
Apparently, that book used fonts that allowed En Dashes or Em Dashes, which are different than the hyphen that represents a minus sign. I think you simply need to delete the existing "dash" in your script and replace it with the hyphen (found on the top row of the keyboard between the 0 and =) as many have suggested here.
0
 
enrique_aeoAuthor Commented:
very interesting, at the night i test... Thanks
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 3
  • 3
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now