Home » Developer & Programmer » Forms » May you help me plz? (Oracle Forms 6i - Windows 7 - DB Oracle 11g)
May you help me plz? [message #645889] Tue, 15 December 2015 16:44 Go to next message
xebec
Messages: 37
Registered: July 2014
Location: Miraflores
Member
Hi my friends;
I need your comments plz.
What I'm trying to do is:
The buttom:
GENERAR_CLAVE
It's going to verified two things:
First;
if the RUC exists on the table PROVWEB
you have to update the password
Second;
if the ruc doesn't exists on the table provweb
you have to insert into a new ruc and a new pas.

Any advice plz...

  • Attachment: 1.jpg
    (Size: 395.65KB, Downloaded 421 times)
Re: May you help me plz? [message #645890 is a reply to message #645889] Tue, 15 December 2015 16:51 Go to previous messageGo to next message
xebec
Messages: 37
Registered: July 2014
Location: Miraflores
Member
Any advice or comment please
Re: May you help me plz? [message #645896 is a reply to message #645890] Wed, 16 December 2015 01:13 Go to previous messageGo to next message
Littlefoot
Messages: 21573
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
OK, so you have the code. What happened when you ran it? Did you get any error? If so, which one? (A candidate might be SELECT DISTINCT RUC ... as it might raise both TOO-MANY-ROWS or - even more likely - NO-DATA-FOUND which you didn't handle).
Re: May you help me plz? [message #645900 is a reply to message #645896] Wed, 16 December 2015 01:43 Go to previous messageGo to next message
JNagtzaam
Messages: 36
Registered: July 2015
Location: Alkmaar
Member

Maybe I'm stupid, but where is the INSERT statement?
And why don't you use MERGE?
Re: May you help me plz? [message #645901 is a reply to message #645900] Wed, 16 December 2015 02:01 Go to previous messageGo to next message
Littlefoot
Messages: 21573
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
I'd say that INSERT is performed within the default Forms processing (i.e. by saving data block values into the table) which, on the other hand, makes UPDATE redundant.
Re: May you help me plz? [message #645912 is a reply to message #645901] Wed, 16 December 2015 03:49 Go to previous message
cookiemonster
Messages: 13894
Registered: September 2008
Location: Rainy Manchester
Senior Member
General comments on the code:

0) Always post code here as text in code tags, as explained here: How to use [code] tags and make your code easier to read?, rather than as an image. It makes our life a lot easier.

1) Variables should be typed to columns using %TYPE where ever possible.
2) You don't need to use a select from dual to run to_char in PL/SQL you could have just done this:
DECLARE

  l_date_val provweb.clave%TYPE;
  
BEGIN

  l_date_val := to_char(SYSDATE, 'YYYY%$DD');

3) The first assignment of a value to :b01.clave is pointless, it just gets overridden by the subsequent assignments.
4) The second IF should be turned into an ELSE of the first IF
5) You appear to be updating the password to a hard-coded value. Are you sure that's what you want?
6) You've got a variable you aren't using.
7) As LF already suggested that select needs a no_data_found exception handler.
8) Shouldn't the commit be at the end?
9) All forms items should be prefixed with the block name when you refer to them.
10) Is the block based on the provweb table? If it is then most of this code is pointless. Forms can work out for itself if an insert or update is needed and will automatically perform it when you try to save.
Previous Topic: Calendar Only For You
Next Topic: where I can load software to create simple oracle form
Goto Forum:
  


Current Time: Wed Jul 08 03:50:05 CDT 2020