Question : sql - date

I have a sql which has in its where clause:
select ....
from ..
where period_nbr in ('2010011','2010012','2010013','2010014','2010015')
This is comprised of three data elements. (e.g. 2010011) The first four positions indicate the fiscal year. The next two indicate the fiscal period within the fiscal year. The last identifies the week number within that fiscal period. (i.e. 20100111 is  snapshot fiscal year 2010, June Period, week 1)


Now I dont want to change this every time I run this sql - how do I parameterise it....?

Answer : sql - date

save you a search...

again though, this is for Oracle only

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
CREATE OR REPLACE TYPE  VCARRAY AS TABLE OF VARCHAR2(4000);

CREATE OR REPLACE FUNCTION str2tbl(p_string IN VARCHAR2, p_delimiter IN VARCHAR2 := ',')
        RETURN vcarray PIPELINED
    AS
        v_length   NUMBER := LENGTH(p_string);
        v_start    NUMBER := 1;
        v_index    NUMBER;
    BEGIN
        WHILE(v_start <= v_length)
        LOOP
            v_index    := INSTR(p_string, p_delimiter, v_start);

            IF v_index = 0
            THEN
                PIPE ROW(SUBSTR(p_string, v_start));
                v_start    := v_length + 1;
            ELSE
                PIPE ROW(SUBSTR(p_string, v_start, v_index - v_start));
                v_start    := v_index + 1;
            END IF;
        END LOOP;

        RETURN;
    END str2tbl;
Random Solutions  
 
programming4us programming4us