home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.databases.oracle      Overblown overpriced overengineered SHIT      2,288 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 1,895 of 2,288   
   Agoston Bejo to All   
   insert into returns 0 rows   
   27 Oct 04 15:17:33   
   
   XPost: comp.databases.oracle.misc, comp.databases.oracle.server   
   From: gusz1@freemail.hu   
      
   Hi,   
   when a SELECT in an INSERT INTO statement returns no rows, NO_DATA_FOUND   
   exception is raised. How do I write a "nice" SELECT INTO when I expect that   
   0 or 1 row gets returned, and the variable should be NULL if no rows are   
   returned.   
   By "nice" I mean that my intention is clear from the source code and no   
   exception-catching is involved, since that would suggest that I'm handling   
   such a condition that shouldn't occur.   
   Therefore the following two techniques are not satisfying:   
      
   SELECT MIN(thefield) INTO myvar ... -- (not clear what is intended)   
      
   BEGIN --exception handling where no real exceptional condition occurs   
   SELECT thefield INTO myvar...   
   EXCEPTION WHEN NO_DATA_FOUND THEN   
   myvar := NULL   
   END;   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca