Home » SQL & PL/SQL » SQL & PL/SQL » how to avoid hard code logic value all over pl/sql application? (Oracle 9.2.0.1.0 ,Windows XP)
how to avoid hard code logic value all over pl/sql application? [message #310845] Wed, 02 April 2008 11:05 Go to next message
ashwin_tampa
Messages: 40
Registered: October 2005
Member
Hello Expert,
Could you please guide me about
How to avoid hard code logic value all over pl/sql application?
Is there something like this? possible?
For Example :


CREATE OR REPLACE PACKAGE test
AS

---place all hard code here as Hardcode Library.

v_code_1  VARCHAR2(32767) :=   ('114','124','134','144','154'); 
v_code_2  VARCHAR2(32767) :=   ('204','450','513','901','918');

---OR put into type table , something like this way if it works

v_code_1  varchar2_tt := varchar2_tt :=   ('114','124','134','144','154'); 
v_code_2  varchar2_tt := varchar2_tt :=   ('204','450','513','901','918');

  procedure proc1;

  function  func1;

END test;

CREATE OR REPLACE PACKAGE BODY TEST
AS

   procedure proc1
   IS
   BEGIN
       
        IF l_code    IN (V_CODE_1) THEN   ----So that I dont have to repeat hard code logic here
          PROCESS......
        ELSIF l_code IN (V_CODE_2) THEN   ----So that I dont have to repeat hard code logic here
          PROCESS....
        END IF;
    
      more process........

   END;


  procedure FUNC1
  RETURN boolean
  IS
  v_check BOOLEAN
  BEGIN
       
        IF l_code    IN (V_CODE_1) THEN  ----So that I dont have to repeat hard code logic here
          PROCESS......
        ELSIF l_code IN (V_CODE_2) THEN  ----So that I dont have to repeat hard code logic here
          PROCESS....
        END IF;
    
      more process........

  RETURN check;
  END;


END TEST;



Appreciate your insight.

Re: how to avoid hard code logic value all over pl/sql application? [message #310847 is a reply to message #310845] Wed, 02 April 2008 11:10 Go to previous message
ThomasG
Messages: 3189
Registered: April 2005
Location: Heilbronn, Germany
Senior Member
So you are basically looking for a variable IN list?

[Updated on: Thu, 03 April 2008 04:36]

Report message to a moderator

Previous Topic: EXTERNAL TABLE
Next Topic: Need Help in creating table with BLOB Column
Goto Forum:
  


Current Time: Sat Dec 10 01:21:58 CST 2016

Total time taken to generate the page: 0.08218 seconds