We help IT Professionals succeed at work.
Get Started

CompariingValues_inplsql

sam15
sam15 asked
on
328 Views
Last Modified: 2012-05-12
Does mod plsql add extra space to the data submitted from HTML form.
 
  I noticed today that even when i do not change any data and hit submit I always get the "Data
Changed" message.
 
  After I added TRIM and NVL (for nulls), it stoppped.
 
 
  Is this how you would compare data inputed via form against record in database.
  I know if a column already has "abc123" and another is NULL, this will not yield correct result.
 
 
 
  open c_org(l_orgcode);
   fetch c_org into l_rec;
   
     
   if  TRIM(NVL(p_name,'abc123')) = TRIM(NVL(l_rec.name,'abc123')) and
       TRIM(NVL(p_addr1,'abc123')) = TRIM(NVL(l_rec.addr1,'abc123'))  and
       TRIM(NVL(p_addr2,'abc123')) = TRIM(NVL(l_rec.addr2,'abc123')) and
       TRIM(NVL(p_city,'abc123')) = TRIM(NVL(l_rec.city,'abc123')) and
       TRIM(NVL(p_state,'abc123')) = TRIM(NVL(l_rec.state,'abc123')) and
       TRIM(NVL(p_zip,'abc123')) = TRIM(NVL(p_zip,'abc123'))  
    then
   
      htp.p('No change in data');
     
    else
      update...
     
      htp.p('Data changed);
     
    end if;


Comment
Watch Question
CERTIFIED EXPERT
Most Valuable Expert 2012
Distinguished Expert 2020
Commented:
This problem has been solved!
Unlock 2 Answers and 16 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE