Oracle Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesOracle Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old July 31st, 2005, 06:00 AM
Ach Ach is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 46 Ach User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 h 36 m 29 sec
Reputation Power: 5
Unhappy Problem with open cursors.

Hi all,I have translated this procedure from T-SQL to PL/SQL.As you see it is a mixed operation

procedure,I mean if some condition is true it does a DML and if other condition is true it does a Query.
Code:
CREATE OR REPLACE PROCEDURE FaxSettings(
                p_USERCODE  number,
                p_HSENDER   VARCHAR2,
                p_HTITLE    VARCHAR2,
                p_DIALTONE  number,
                p_PREFFIX   VARCHAR2,
                p_WAIT      number,
                p_DIALRETRY number,
                p_READWRITE number,
                p_MODEM     VARCHAR2,
                p_FAXSERVER NUMBER,
                p_result_cur OUT sys_refcursor)

AS

  v_counter NUMBER := 0;
 
  BEGIN

  IF p_READWRITE = 1 then
    
      SELECT COUNT(*)
      INTO v_counter
      FROM   UserAProFaxSettings
      WHERE  Code = p_USERCODE;

      IF v_counter = 0 then
    
          INSERT INTO UserAProFaxSettings (Code,Sender,Title,DialTone
                                          ,Preffix,DialWait,DialRetry,Modem,FaxServer)
          VALUES      (p_USERCODE,
                      p_HSENDER,
                      p_HTITLE,
                      p_DIALTONE,
                      p_PREFFIX,
                      p_WAIT,
                      p_DIALRETRY,
                      p_MODEM,
                      p_FAXSERVER);
             
       ELSE 
       
          UPDATE UserAProFaxSettings
          SET    Sender = p_HSENDER,
                 Title = p_HTITLE,
                 DialTone = p_DIALTONE,
                 Preffix = p_PREFFIX,
                 DialWait = p_WAIT,
                 DialRetry = p_DIALRETRY,
                 Modem = p_MODEM,
                 FaxServer = p_FAXSERVER
          WHERE  Code = p_USERCODE;
          
        END IF;
      
   END IF;

  IF p_READWRITE = 2 THEN

  OPEN p_result_cur for
   
      SELECT *
      FROM   UserAProFaxSettings
      WHERE  Code = p_USERCODE;
      
  END IF;

 END FaxSettings;
/

The problem is: I don't know it will be a DML without cursor or a Query with a returned cursor to

application.So I do not know if I should close that cursor in application or no?
Any help will be so appreciated.

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesOracle Development > Problem with open cursors.


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT