To get all records using the CASE function

first_tbl

First_dt second_dt point
1 January 09 item1 1 July 09
April 1 09 item1 1 December 09
1 July 09 31 December 09 item1
December 15 09 10 May 10 item1
March 20, 12 10 August 12 item2
July 31, 12 15 December 12 item2
April 1 09 31 December 09 item2

second_tbl

Start_dt point end_dt flag
August 1 09 1 November 09 item1 null
2 November 09 1st December 09 item1 null
1 December 09 15 December 09 item1 null
December 15 09 31 December 09 item1 null
1 January 10 10 May 10 item2 null
10 May 10 December 31, 10 item2 null
1 January 12 March 15, 12 item2 null
March 20, 12 31 July 12 item2 null

I need o/p so that, if first_dt or second_dt between start_dt and end_dt, I need to make the flag as y (item is the common join) other wise 'n'.

I was able to make the flag go ' but not ' don't

Select A.first_Dt, A.second_Dt, B.Start_Dt, B.End_Dt, A.item, point.

Cases where B.falg is null
Then "n".
Else 'Y '.
End
Of firsttbl A, second_tbl B
Where
A.Item = B.Item

and

((A.first_Dt > =B.Start_Dt et A.first_Dt < = B.End_Dt))
Or
(A.second_Dt > =B.Start_Dt et A.second_Dt < = B.End_Dt)) ;

Please kindly help me to resolve this bug.

Thanks for your help in advance!
select f.first_dt,f.second_dt,s.start_dt,s.end_dt,
       case when
             first_dt between start_dt and end_dt
           or
             second_dt between start_dt and end_dt
            then 'N'
           else 'Y'
       end flag
from first_tbl f,second_tbl s
where f.item = s.item

Tags: Database

Similar Questions

  • need help to get the value using the REGEXP_REPLACE function.

    I am trying to extract the value placed between "< listitems >... < / listitems >" but I am unable to get these value using the REGEXP_REPLACE function.
    select REGEXP_REPLACE('<InputParameters></ParamSet><listitems>14545454</listitems></ParamSet></InputParameters>'
    ,'(<InputParameters>.*<listitems>)(.*)(</listitems>.*<InputParameters>)'
    ,'\2') from dual;
    required output:
     1454554
    Can someone please help me achieve this goal.

    Hello

    You forgot the / before the last InputParameters. If fix you that, your code will work.

    Here is a slightly different way:

    SELECT  REGEXP_REPLACE ( '14545454'
                     , '^.*?(.*?).*$'
                     , '\1'
                     )     AS listitems
    FROM    dual
    ;
    

    Least to type, the less likely you will have to make typos.
    If there are 2 (or more) elements of listitmes, 1 will be returned.

    From Oracle 11.1, you can also use REGEXP_SUBSTR. I have Oracle 10.2 avaialable now, so I can test the following, but I think you'd say:

    SELECT  REGEXP_SUBSTR ( '14545454'
                     , '(.*?)'
                     , 1
                     , 1
                     , NULL
                     , 1
                     )     AS listitems
    FROM    dual;
    

    When it comes with the text that is or looks to, XML, consider using XML functions.

  • Can we get all the contacts that are in the Blackberry phone using the PIM functionality that is, JSR 75?

    Hello guys,.

    I need to develop an application that should support devices such as the Bold 9700 and Pearl, Storm, Blackberry Curve 8900. If I go for j2me / MIDP, what will be the limits that I face in blackberry? Is it recommended to go for j2me or device-specific development of RIM.

    Can we get all contacts into the Blackberry phone using PIM JSR 75 i.e and other native features features if developing an application in j2me for blackberry. I guess that the user interface will be completely different, but we support all the controls that supports the JDE?

    Is someone can you please tell me if I can get access to all contacts present in the Blackberry phone using 'javax.microedition.pim' API - that is not specific to the RIM. Has anyone tried this one virtually on the phone or emulator?

    Y at - it something like a website where I can test my application on Blackberry devices as in the Nokia Forum Sites?

    Thanks in advance.

    Kind regards

    Raki

    JSR75 is supported

    However, there are some extensions specific "Blackberry" for the base PIM classes. These add a few extension Blackberry PIM data. I think that you can only use the JSR 75 classes as long as you don't need BB extensions.

    For the test, the development environment provides the device simulators.

  • I use the random function and he know instructions 'case' must end with a ':' but it is!

    I use the random function and he know instructions 'case' must end with a ':' but it is! I put

    case 10000 timer += 2; popupName._visible = true; :

    then I put

    case of 10000 {timer += 2; popupName._visible = true ;}:}

    but he still know it.

    What I am doing wrong?

    First of all, whenever you have more than three similar lines, you should probably refactor something.  Especially when you have 10,000 lines. This should have sounded the alarm, but I guess you are new to this.

    Second, when you have such a long code, paste everything here. Please, I beg you. It's a pain to navigate the thread.

    And here's what I * think * you really want:

    If (random (10001) == 10000) {}

    timer += 2;

    popupName._visible = true;

    }

    It simply means: "take a random number between 0 and 10001 (exclusive). If this number is 10,000, do something. If not, ignore this code block. »

  • When I use the library function node call in real time, is loaded only once for all or load the DLL whenever it is called?

    When I use the library function node call in real time, is loaded only once for all or load the DLL every time when it is called?

    I have a critical application in real time, in which I use a piece of DLL function developed in C++.  It is ok?  Make sure any senior developer?

    Thank you in advance.

    The user interface thread is the thread that is used to update the user interface. It's slow. And it's supposed to be that way because humans are slow.

    The call library function node can be configured as this thread to use in the configuration for it dialog box. Please visit the LabVIEW documentation on how to do this.

  • I installed lightroom on a new computer (windows 10) cc. I copied all of my original photos on a hard drive and them imported by adding them on the new computer using the import function. I have a catalog update saved on thehard d

    I installed lightroom on a new computer (windows 10) cc. I copied all of my original photos on a hard drive and them imported by adding them on the new computer using the import function. I have a catalog to date backed on thehard drive and have tried to insert into the new folder to lightroom. Unfortunately none of my changes, collections etc. seem to be present on the new computer. I still work lightroom with any changes on the old computer where all the photos. Help

    He seemed to have solved this problem - the catalogue of the old computer has been saved as a zip file. Once extracted, it could be used as the primary catalog for lightroom on the new computer

  • How to use the Substring function with Case statement.

    Hi all

    I have a requirement where I have to use the substring function on the ground for the report criteria.
    FOR EXAMPLE
    I branch domain name where I have all the information of the branch names, now some of the branch names are too large with an extension after the name.
    now I want substing it, but the length of characters varies for each branch.
    so is it possible where we use a box where we can define if the character of name plug exceed a value then he substing with this length.

    Try something like this:

    LENGTH WHEN CARTER (tablename. Branch_Name) > n THEN SUBSTRING (...) Of ANOTHER tablename. Branch_Name END

    where n is the number of characters that you want to start the break.

  • SQL using the analytic function


    Hi all

    I want a help in the creation of my SQL query to retrieve the data described below:

    I have a test of sample table containing data as below:

    State ID Desc

    MICHAEL 1 T1

    ACTIVE 2 T2

    T3 3 SUCCESS

    DISABLE THE T4 4

    The thing I want to do is to select all the lines with an ACTIVE status in the table but is there is no ACTIVE status, my request will give me the last line with MICHAEL status.

    I can do this in a single request by using the analytical function for example, if yes can yiu help me on the request of unpacking.

    Kind regards

    Raluce

    Something like that?

    I had to fix it.

    with testdata until)
    Select 1 id, "T1" dsc "DISABLED" status of Union double all the
    Select 2 id, 'T2' dsc, the status "ACTIVE" of all the double union
    Select id 3, "T3" dsc, the status of 'SUCCESS' of all the double union
    Select 4 id, "T4" dsc "DISABLED" status of double
    )

    Select
    ID
    dsc
    status
    of testdata
    where
    status =
    -case when (select count (*) in testdata where status = 'ACTIVE') > 0
    then 'ACTIVE '.
    Another 'DISABLED '.
    end
    and)
    ID in (select id from testdata where status = ' ACTIVE')
    or
    ID = (select max (id) in testdata when status = 'DISABLED')
    )

    STATE ID DSC

    '2' 'T2' 'ACTIVE '.

    Maybe it's more efficient

    Select
    ID
    dsc
    status
    of testdata
    where
    status =
    -case when (select count (*) in testdata where status = 'ACTIVE') > 0
    then 'ACTIVE '.
    Another 'DISABLED '.
    end
    and
    ID =)
    -case when (select count (*) in testdata where status = 'ACTIVE') > 0
    then id
    on the other
    (select max (id) in testdata when status = 'DISABLED')
    end
    )

    Post edited by: correction of chris227

    Post edited by: chris227
    extended

  • to use the NOW() function with operator (such as NOW () - 120) 11.1.1.6.11 or 11.1.1.7.1

    Hi all

    I want to use the function NOW with a different operator in obiee11.1.1.6.11 or 11.1.1.7.1

    but every time I have a creating a filter as

    TRAN_DATE is equal to NOW()-120, we become "an arithmetic operation is being performed on a non-digital type.»

    11.1.16.11 and 11.1.1.7.1

    Hare TRAN_DATE is in RPD datetime data type

    Can someone tell me how to replace the error and make the report run and return the results

    Do now () - 120 is a very simplistic way to look at it because it is highly ambiguous. IE: NOW less 120 "what?" Minutes? Seconds? Years? Petroleum products?

    Accuracy is the key. Now() gives a timestamp (a real timestamp DATA TYPE object!), so I guess you mean days.

    Timestamp data types are changed (projected through time) using the TIMESTAMPADD function, which in your case would by this formula:

    TIMESTAMPADD (SQL_TSI_DAY,-120, NOW()))

  • How to use the NVL function to a parameter with comma delimited values

    Gurus,

    It is confusing to me.  I am trying to use the NVL function, but the setting that I'm passing in my cursor contains multiple values with commas.  The NVL function is confused when analyzing the values.

    'Where' cursor clause...

    and nvl (sn.c_attribute1,'x@#$%') in nvl (p_desig,'x@#$%'( )

    translated parameter values...

    and nvl (sn.c_attribute1,'x@#$%') in nvl ('SPRT''GOOD' 'BAD' 'x@#$%') -NVL does not parse the value correctly

    Any idea on how to get NVL recognize 'x@#$%' , if p_desig is null?

    Thank you

    Scott

    HI, Scott.

    Whenever you have a problem, please post a small example data (CREATE TABLE and only relevant columns, INSERT statements) of all the tables involved, so that people who want to help you can recreate the problem and test their ideas.

    Also post the results you want from this data, as well as an explanation of how you get these results from these data, with specific examples.

    Always say what version of Oracle you are using (for example, 11.2.0.2.0).

    See the FAQ forum: https://forums.oracle.com/message/9362002#9362002

    My best guess, based on what you posted bone is present, that your problem is discussed in the following:

    http://tkyte.blogspot.com/2006/06/varying-in-lists.html

    http://www.Oracle-base.com/articles/Misc/DynamicInLists.php

  • Using the REGEXP_REPLACE function

    I am trying to get an understanding of the REGEXP_REPLACE function on this question and answer:

    Question: Some employees have entered the product_code correctly. It should appear as a series of characters followed by a bar slash followed by another set of characters.
    Instead of putting the single slash / separates the two groups of characters, some industsrie are entered in spaces, dashes, or both.

    Format of all product codes by deleting all the extra spaces and hyphens and replace them with a single.

    Answer: REGEXP_REPLACE (product_code, ' (()) {1,} |) (-)) {1, } ', '/')

    I'm confused about the implementation of the media in the service as well as doing the tube?

    I guess it's the same thing as an OR operator, but I'm not sure.

    I have read the documentation on REGEXP_REPLACE oracle but I'm still not sure.

    Hello

    993451 wrote:
    I am trying to get an understanding of the REGEXP_REPLACE function on this question and answer:

    Question: Some employees have entered the product_code correctly. It should appear as a series of characters followed by a bar slash followed by another set of characters.
    Instead of putting the single slash / separates the two groups of characters, some industsrie are entered in spaces, dashes, or both.

    Format of all product codes by deleting all the extra spaces and hyphens and replace them with a single.

    Answer: REGEXP_REPLACE (product_code, ' (()) {1,} |) (-)) {1, } ', '/')

    Are you sure this is the answer given? It does not work when I try.
    It seems that there are extra spaces, and I suspect some round parentheses should really be hooks, or are not really necessary.

    If I understand the problem, it's a solution:

    REGEXP_REPLACE ( product_code
                , '[ -]+'
                , '/'
                ) 
    

    The brackets surround a character set. In this case, the set contains 2 members: space and dash. The sign means that we are looking for 1 or more characters in the game.

    I'm confused about the implementation of the media in the service as well as doing the tube?

    I guess it's the same thing as an OR operator, but I'm not sure.

    Yes, the riser means 'GOLD '.

    I have read the documentation on REGEXP_REPLACE oracle but I'm still not sure.

    Yes, the Oracle documentation is designed as a reference, not a tutorial and parts on regular expressions are not the best, the Oracle has published.
    Try these sites:
    http://www.sqlsnippets.com/en/topic-10759.html
    http://www.DBA-Oracle.com/t_regular_expressions.htm
    Introduction to regular expressions... last part.

  • Using the Replace function

    Hi all

    I have a column called supplements and it has values such as

    1. the payment is > 90 days
    2. the payment is < = 10 days

    Now, I want to use the Replace function to replace > and < to "greaterthan".
    and 'lessthan' RESP, but the problem is that, in the function replace, I can give that one argument. So what I do is in the region of fx for the column

    Replace (supplements,' > ',' greaterthan')

    This replaces the > sign very well with string greaterthan and show me values such as

    1. the payment is greaterthan 90 days
    2. the payment is < = 10 days

    but I want to replace < "lessthen" also, how can I do? Can I undergo two replace statements? How can replace several string or special characters for a single column?

    Help, please.

    Thank you
    Ronny

    Try this
    CASE
    WHEN supplements LIKE ' % > %' THEN Replace(latepayment,'>','greaterthan')
    WHEN supplements LIKE ' %<=%' then=""><>
    END

  • help in the application without using the pivot function

    Hi gurus,

    Can you please help write the query without using the PIVOT function.
     WITH indata AS
             (SELECT 1 sn, '123:456,789,323:456,213,344,345:5454' x
                from dual
              UNION ALL
              SELECT 2, 'abcd:fgrfr,rfrf,rfred,tg:tg,tg:ophhh,op,vdfgbh:poijn' x from dual),
            instr AS
             (SELECT a.SN,
                     rownum RN,
                     B.column_value || CASE
                       WHEN B.column_value NOT LIKE '%:%' THEN
                        ':'
                     END column_value 
                FROM indata a,
                     TABLE(CAST(multiset
                                (SELECT trim(SUBSTR(x,
                                                    (CASE LEVEL
                                                      WHEN 1 THEN
                                                       1
                                                      ELSE
                                                       instr(x, ',', 1, LEVEL - 1) + 1
                                                    END),
                                                    (CASE instr(x, ',', 1, LEVEL)
                                                      WHEN 0 then
                                                       4000
                                                      ELSE
                                                       instr(x, ',', 1, LEVEL) - 1 -
                                                       (CASE LEVEL
                                                          WHEN 1 THEN
                                                           0
                                                          ELSE
                                                           instr(x,
                                                                 ',',
                                                                 1,
                                                                 level - 1)
                                                        END)
                                                    END)))
                                   FROM dual
                                 CONNECT BY level <=
                                            LENGTH(x) -
                                            LENGTH(REPLACE(x, ',', '')) + 1) AS
                                sys.odcivarchar2list)) b)
            SELECT  col1_val2,
                    col1_val1,
                    col2_val2,
                    col2_val1,              
                   systimestamp
              FROM (select SN,
                          ROW_NUMBER() over(partition by SN order by RN) RN,
                           SUBSTR(column_value, INSTR(column_value, ':') + 1) VAL1,
                           substr(column_value, 1, instr(column_value, ':') - 1) val2
                      FROM instr ) PIVOT(MAX(VAL1) VAL1, MAX(VAL2) VAL2 FOR SN IN(1 as col1,2 as col2));
    Thanks in advance!...

    Any help would be appreciated.

    user590978 wrote:

    Can you please help write the query without using the PIVOT function.

    with indata as (
                    select 1 sn,'123:456,789,323:456,213,344,345:5454' x from dual union all
                    select 2, 'abcd:fgrfr,rfrf,rfred,tg:tg,tg:ophhh,op,vdfgbh:poijn' x from dual
                   ),
             t1 as (
                    select  x
                      from  indata
                      where sn = 1
                   ),
             t2 as (
                    select  x
                      from  indata
                      where sn = 2
                   ),
             t3 as (
                    select  level lvl,
                            substr(
                                   x,
                                   instr(',' || x,',',1,level),
                                   instr(x || ',',',',1,level) - instr(',' || x,',',1,level)
                                  ) col1
                      from  t1
                      connect by level <= length(x) - length(translate(x,'A,','A')) + 1
                   ),
             t4 as (
                    select  level lvl,
                            substr(
                                   x,
                                   instr(',' || x,',',1,level),
                                   instr(x || ',',',',1,level) - instr(',' || x,',',1,level)
                                  ) col2
                      from  t2
                      connect by level <= length(x) - length(translate(x,'A,','A')) + 1
                   ),
             t5 as (
                    select  lvl,
                            substr(col1,1,instr(col1 || ':',':') - 1) col1_val1,
                            substr(col1,instr(col1 || ':',':') + 1) col1_val2
                      from  t3
                   ),
             t6 as (
                    select  lvl,
                            substr(col2,1,instr(col2 || ':',':') - 1) col2_val1,
                            substr(col2,instr(col2 || ':',':') + 1) col2_val2
                      from  t4
                   )
    select  col1_val1,
            col1_val2,
            col2_val1,
            col2_val2,
            systimestamp
      from      t5
            full join
                t6
            on (
                t6.lvl = t5.lvl
               )
      order by coalesce(t5.lvl,t6.lvl)
    /
    
    COL1_VAL1  COL1_VAL2  COL2_VAL1  COL2_VAL2  SYSTIMESTAMP
    ---------- ---------- ---------- ---------- -------------------------------------
    123        456        abcd       fgrfr      23-OCT-12 11.50.12.015000 AM -04:00
    789                   rfrf                  23-OCT-12 11.50.12.015000 AM -04:00
    323        456        rfred                 23-OCT-12 11.50.12.015000 AM -04:00
    213                   tg         tg         23-OCT-12 11.50.12.015000 AM -04:00
    344                   tg         ophhh      23-OCT-12 11.50.12.015000 AM -04:00
    345        5454       op                    23-OCT-12 11.50.12.015000 AM -04:00
                          vdfgbh     poijn      23-OCT-12 11.50.12.015000 AM -04:00
    
    7 rows selected.
    
    SQL> 
    

    SY.

  • Request covered all records using years as refrence

    Hi all

    My problem came as sequence of another thread, I've created here in the forum: analytical - features grouping of years
    All the proposed solutions were very useful, but not perfect one.

    Although I found a solution to this problem that doesn't involve creating a query, I came back with a similar situation with a need for the query. I'll try to better explain the issue.

    I have my data like this sample
    WITH dis AS (SELECT   1 AS COD,
                          'A' AS uc,
                          1977 AS initial_year,
                          2002 AS end_year,
                          10024 AS pe_codigo
                   FROM   DUAL),
        cred AS (SELECT   100 AS id,
                          'A' AS uc,
                          1982 AS initial_year,
                          1982 AS end_year,
                          2 AS credits,
                          10024 AS pe_codigo
                   FROM   DUAL
                 UNION ALL
                 SELECT   200 AS id,
                          'A' AS uc,
                          1986 AS initial_year,
                          1986 AS end_year,
                          7 AS credits,
                          10024 AS pe_codigo
                   FROM   DUAL
                 UNION ALL
                 SELECT   300 AS id,
                          'A' AS uc,
                          1988 AS initial_year,
                          1988 AS end_year,
                          4 AS credits,
                          10024 AS pe_codigo
                   FROM   DUAL
                 UNION ALL
                 SELECT   55 AS id,
                          'A' AS uc,
                          1989 AS initial_year,
                          1989 AS end_year,
                          3 AS credits,
                          10024 AS pe_codigo
                   FROM   DUAL
                 UNION ALL
                 SELECT   330 AS id,
                          'A' AS uc,
                          1990 AS initial_year,
                          1990 AS end_year,
                          4 AS credits,
                          10024 AS pe_codigo
                   FROM   DUAL
                 UNION ALL
                 SELECT   102 AS id,
                          'A' AS uc,
                          1991 AS initial_year,
                          1991 AS end_year,
                          6 AS credits,
                          10024 AS pe_codigo
                   FROM   DUAL)
    -DIS is a table with many distinct pairs of UC/PE_CODIGO.
    -Table CRED have some additional data of each UC/PE_CODIGO. Each UC/PE_CODIGO may have one or more records with different INITIAL_YEAR and END_YEAR (and credits).

    What I need?
    -J' I need a query that returns all records, joining the two tables by PE_CODIGO and UC is, and covering the range of years that's on the table, SAY. In this example, I want to record from the year 1977 until 2002.
    Using this rule (and this example) I want a record between 1997 and 1981, between 1982 and 1982, others from 1983 to 1985, from 1986 until 1986, and so on like this:
    COD    ID    UC     initial_year    end_year    credits    pe_codigo
    1    NULL     A        1977            1981         NULL       10024
    1    100      A        1982            1982         2          10024
    1    NULL     A        1983            1985         NULL       10024
    1    200      A        1986            1986         7          10024
    1    NULL     A        1987            1987         NULL       10024
    1    300      A        1988            1988         4          10024
    1    55       A        1989            1989         3          10024
    1    330      A        1990            1990         4          10024
    1    102      A        1991            1991         6          10024
    1    NULL     A        1992            2002         NULL       10024
    Notes:
    -TELL is considered to be a "pivot table". I only need chronogram SAY. Coming INITIAL_YEAR.
    -END_YEAR (in both tables) can have a NULL value
    -When I have no records in the table CRED with years between, the credits column must be a null (not NULL as String). And Yes ID column.
    -One END_YEAR must have (not NULL as String) NULL values.

    The best I can go it is with this query:
    SELECT   a.cod,
             b.id,
             b.uc,
             b.initial_year,
             LEAST (
                 b.end_year,
                 LEAD (b.initial_year)
                     OVER (PARTITION BY b.uc ORDER BY b.initial_year)
                 - 1)
                 end_year,
             b.credits,
             a.pe_codigo
      FROM   cred b, dis a
     WHERE       a.uc = b.uc
             AND a.pe_codigo = b.pe_codigo (+)
             AND a.end_year >= b.initial_year
    COD      ID     UC     initial_year    end_year    credits    pe_codigo
    1     100     A     1982              1982             2     10024
    1     200     A     1986              1986             7     10024
    1     300     A     1988              1988             4     10024
    1     55      A     1989              1989             3     10024
    1     330     A     1990              1990             4     10024
    1     102     A     1991                          6     10024
    I have different scenarios in the CRED table. But I only need a query which can multiply records between SAY. INITIAL_YEAR and SAY. END_YEAR based in the information I have in the CRED table.

    Sorry for the long explanation.
    Can someone help me, please?
    Thank you
    Filipe Almeida

    Published by: Filipe_Almeida on ago 10/2011 08:09

    Hi, Filipe,

    The results you want with these new data sample even as the results that you have published with the latest data from the sample?

    Filipe_Almeida wrote:
    The line with COD = 2 is a different record that cod = 1. Have the same value of UC, but have a different PE_CODIGO. So it is another record.

    Yes, it's another record. This is exactly why I don't understand why you want to see cod = 1 in the output for the line where pe_codigo = 10000.

    If you wish, you can put 'B' in the column of the CPU for recording with COD = 2...

    You say there is a line in the output with the cod = 2? In the results of the sample you have validated, cod = 1 on all lines. Mayber, you need to verify that the results are accurate and post the correct results if they are not.

    in tables DIS1 and DIS2 and ID = line 150 CRED table, as well.

    Sorry, I'm dion can't understand this. In the examples of new data, is not uc = 'A' for all rows in all tables? Why is - it normal to have a CPU = "B" in the output?

    END_YEAR = NULL means that, after INITIAL_YEAR, UC, this number of credits to infinity. For example (using DIS2), UC = 'A' with PE_CODIGO = 10024, in the year 2011 or the year 9999 is worthless credits. The same CPU, but in the year 1989 have 3 credits. But the year 1984 have no credit.
    This END_YEAR cannot be NULL when we value END_YEAR DIS table for this specific/PE_CODIGO CPU. In this case the recordset must be completed this year.

    I see it; you want to treat a NULL end_year as impossibly high, all year effective at the latest. As my last request was written, it is only a matter then generate a fictitious line dated after the last row of the cred. I did it in the query below, by chaniging

    df.end_year
    

    TO

    NVL (df.end_year, 9999)
    

    in the last part of the UNION. Find the comment "CHANGED" very near the end.

    WITH       prev    AS
    (
         SELECT     dp.cod
         ,     cp.id
         ,     dp.uc
         ,     1 + LAG ( cp.end_year
                       , 1
                       , dp.initial_year - 1
                   ) OVER ( PARTITION BY  cp.uc
                                ,            cp.pe_codigo
                         ORDER BY      cp.initial_year
                          )       AS initial_year
         ,       cp.initial_year - 1    AS end_year
         ,     NULL                 AS credits
         ,     cp.pe_codigo
         FROM    cred    cp
         JOIN     dis     dp  ON      cp.pe_codigo     = dp.pe_codigo
                       AND      cp.end_year   >= dp.initial_year
    )
    SELECT       *
    FROM       prev
    WHERE       initial_year     <= end_year
           --
        UNION ALL
               --
    SELECT       dc.cod
    ,       cc.id, dc.uc
    ,        GREATEST ( cc.initial_year
                   , dc.initial_year
                 )                    AS initial_year
    ,       NVL (cc.end_year, dc.end_year)     AS end_year
    ,       cc.credits, cc.pe_codigo
    FROM      cred  cc
    JOIN       dis     dc  ON   cc.pe_codigo     = dc.pe_codigo
                  AND      COALESCE ( cc.end_year
                                   , dc.end_year
                          , dc.initial_year
                               )         >= dc.initial_year
           --
        UNION ALL
               --
    SELECT       df.cod
    ,       NULL               AS id
    ,       df.uc
    ,       1 + MAX (cf.end_year)     AS initial_year
    ,       df.end_year
    ,       NULL               AS credits
    ,       df.pe_codigo
    FROM      cred  cf
    JOIN       dis     df  ON   cf.pe_codigo     = df.pe_codigo
    GROUP BY  df.cod
    ,            df.uc
    ,       df.pe_codigo
    ,       df.end_year
    HAVING       MAX (cf.end_year)     < NVL ( df.end_year          -- CHANGED
                                    , 9999
                              )
           --
    ORDER BY  7       -- pe_codigo
    ,            4       -- initial_year
    ;
    
  • Using the crypt function

    Hi, I have a login page and I want to encrypt the password. What I must first encrypt it and place it in the DB? I already have a 'normal text' user name and pass word in there to test and everthing works fine, I restrict access to work on the admin page after login. So, my next step is to harden a bit of security. I searched the web and couldn't find static function crypt as examples below. Not quite normal I have to do. I read on another site where you would need to put passwords in the DB already encrypted by PHP and then write a script to compare. I don't necessarily want to create passwords encrypted on the fly (I think), as in the case of a new user type scenerio, are some users to access the admin section and want these "*" appears in the password field.

    steevo2 wrote:
    > Hi, I have a login page and I want to encrypt the password. What I need to
    > first encrypt it and place it in the DB?

    Yes. The best way to do it with PHP is to use the sha1() function,
    which produces an encryption of 40 characters in a string. This means that
    your password in the database column must be 40 characters wide.

    Dreamweaver is not a way to encrypt the data before inserting it into
    the database, you will need to do it manually. Put this at the top of the
    page contains it the user registration form:

    <>
    If (isset($_POST['password'])) {}
    $_POST ["password"] = sha1($_POST['password']);
    }
    ?>

    > I read on another site
    > where you would need to put passwords in the DB already encrypted by PHP
    > and then write a script to compare.

    All you need to do is add the same code as above at the top of the page
    who uses the Log user Dreamweaver Server behavior.

    > wanting * to show
    > upward into the password field.

    This is done by selecting the password for the TextField input Type
    element in the property inspector.

    --
    Adobe Community Expert David Powers
    Author, "The Essential Guide to Dreamweaver CS3" (friends of ED)
    Author, "PHP Solutions" (friends of ED)
    http://foundationphp.com/

Maybe you are looking for

  • Satellite Pro L300 (PSLB9A - 02L 001) - remove Vista and install Windows XP

    I'm waiting for delivery of a L300. I also bought XP I want to install XP as soon as I get the L300. The laptop comes with Vista installed which I never liked. I intended to create a Vista recovery disc just to make sure before you start the conversi

  • Appropriate use of the specific functions of IVI Driver

    Hello I have to call niDMM driver specific functions, for example the diode test function and source of current value. I am able to do using IVI step types. I just input function and the ID attribute of the niDMM header files. I would use the IVI dri

  • What is BlackBerry_App_Descriptor.xml?

    Hello world! I'm interesting on BlackBerry_App_Descriptor.xml file. What is it? Thanks for your time

  • Profile for the account of the Ambassador Hall? Where? What?

    Hello. I am doing an Ambassador Hall in MBS (v5.2.110.0), and I said I need a profile (in the default tab the Ambassador Hall), but the list is empty. But what profiles are we talking? What is WLAN profiles? I have many of these. Where do these profi

  • C7280 All in 1 - point fax work

    Hello I have a problem with my ALL in 1 printer C7280 HP The fax stop working. Continue to send a message (unable to send or receive faxes). I try to reinstall the software, but do not work. Please let me know as soon as possible. Thank you. Cain Aya