[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.2

Stored Proc code

Asked by jaggernat in DB2 Database

Tags: sp_status, asutime, code

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>                                                                          
-- INITIAL                              02/13/2004  Jay                  
--                                                                              
  CREATE PROCEDURE SampleSP                                                    
   (IN I_ITEM_ID             CHAR(9),                                          
    IN I_STATUS              CHAR(01),                                          
    IN I_STATUS_REASON_CD    CHAR(02),                                          
      OUT  SP_STATUS         INTEGER)                                          
            FENCED                                                              
        RESULT SET 1                                                            
          LANGUAGE SQL                                                          
    NOT DETERMINISTIC                                                          
    MODIFIES SQL DATA                                                          
         NO DBINFO                                                              
            COLLID RSSPONLN                                                    
                NO WLM ENVIRONMENT                                              
           ASUTIME NO LIMIT                                                    
     STAY RESIDENT YES                                                          
      PROGRAM TYPE MAIN                                                        
          SECURITY DB2                                                          
  COMMIT ON RETURN NO                                                          
                                                                               
   P1: BEGIN                                                                    
                                                                               
     DECLARE SQLSTATE    CHAR(5) DEFAULT '00000';                              
     DECLARE SQLCODE     INTEGER DEFAULT 0;                                    
  DECLARE SEL_CSR CURSOR WITH RETURN FOR                                        
--                                                                              
  SELECT RE.ITEM_ID                                                            
        ,RE.EDITION_ID                                                          
        ,RE.CUR_VERSION                                                        
        ,R.FREQUENCY                                                            
        ,RE.STATUS                                                              
        ,RE.STATUS_REASON_CODE                                                  
        ,RE.STATUS_REASON_COMM                                                  
        ,RE.EDITION_EXP_DATE                                                    
        ,FF.FILE_FORMAT                                                        
  FROM    RST_REPORT_EDITION RE,                                                
          RST_ITEM_FORMAT    FF,                                                
          RST_REPORT         R                                                  
                                                                               
     WHERE  RE.ITEM_ID            LIKE I_ITEM_ID                                
       AND  RE.ITEM_ID            = FF.ITEM_ID                                  
       AND  RE.ITEM_ID            = R.ITEM_ID                                  
       AND  RE.EDITION_ID         = FF.EDITION_ID                              
       AND  RE.STATUS             LIKE  I_STATUS                                
       AND  RE.STATUS_REASON_CODE LIKE  I_STATUS_REASON_CD                      
       ;                                                                        
     DECLARE EXIT HANDLER FOR SQLEXCEPTION                                      
             SET SP_STATUS = SQLCODE;                                          
--                                                                              
   OPEN SEL_CSR;                                                                
--                                                                              
   SET SP_STATUS = SQLCODE;                                                    
   END P1                                                                      

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>


Hi experts,

was trying to understand above stored proc.what it does is takes three arguments


    IN I_ITEM_ID             CHAR(9),                                          
    IN I_STATUS              CHAR(01),                                          
    IN I_STATUS_REASON_CD    CHAR(02),  


//and returns back the following

         RE.ITEM_ID                                                            
        ,RE.EDITION_ID                                                          
        ,RE.CUR_VERSION                                                        
        ,R.FREQUENCY                                                            
        ,RE.STATUS                                                              
        ,RE.STATUS_REASON_CODE                                                  
        ,RE.STATUS_REASON_COMM                                                  
        ,RE.EDITION_EXP_DATE                                                    
        ,FF.FILE_FORMAT    

                                                     
//FROM these tables

          RST_REPORT_EDITION RE,                                                
          RST_ITEM_FORMAT    FF,                                                
          RST_REPORT         R                                                  

//if these conditions are true
                                                                               
     WHERE  RE.ITEM_ID            LIKE I_ITEM_ID                                
       AND  RE.ITEM_ID            = FF.ITEM_ID                                  
       AND  RE.ITEM_ID            = R.ITEM_ID                                  
       AND  RE.EDITION_ID         = FF.EDITION_ID                              
       AND  RE.STATUS             LIKE  I_STATUS                                
       AND  RE.STATUS_REASON_CODE LIKE  I_STATUS_REASON_CD                      
       ;                                              



Now , I am not sure what the other parts of the code mean like this peice at the top

++++++++++++++++++++++++
  OUT  SP_STATUS         INTEGER)                                          
            FENCED                                                              
        RESULT SET 1                                                            
          LANGUAGE SQL                                                          
    NOT DETERMINISTIC                                                          
    MODIFIES SQL DATA                                                          
         NO DBINFO                                                              
            COLLID RSSPONLN                                                    
                NO WLM ENVIRONMENT                                              
           ASUTIME NO LIMIT                                                    
     STAY RESIDENT YES                                                          
      PROGRAM TYPE MAIN                                                        
          SECURITY DB2                                                          
  COMMIT ON RETURN NO                                                          
                                                                               
   P1: BEGIN                                                                    
                                                                               
     DECLARE SQLSTATE    CHAR(5) DEFAULT '00000';                              
     DECLARE SQLCODE     INTEGER DEFAULT 0;                                    
  DECLARE SEL_CSR CURSOR WITH RETURN FOR        
++++++++++++++++++++++


and this peice at the bottom


+++++++++++++++++++++++
  DECLARE EXIT HANDLER FOR SQLEXCEPTION                                      
             SET SP_STATUS = SQLCODE;                                          
--                                                                              
   OPEN SEL_CSR;                                                                
--                                                                              
   SET SP_STATUS = SQLCODE;      
+++++++++++++++++++++++

any help appreciated

thanks
J
 
Related Solutions
Keywords: Stored Proc code
 
Loading Advertisement...
 
[+][-]10/02/06 11:55 AM, ID: 17645801Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zone: DB2 Database
Tags: sp_status, asutime, code
Sign Up Now!
Solution Provided By: Kdo
Participating Experts: 1
Solution Grade: A
 
[+][-]10/02/06 07:19 PM, ID: 17648732Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10/03/06 05:02 AM, ID: 17650706Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/12/06 12:40 PM, ID: 17926286Administrative Comment

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 30-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]11/16/06 10:07 PM, ID: 17963023Administrative Comment

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 30-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091021-EE-VQP-81