How I can check this condition

Hi,
Through PLSQL code how I can check the following condition.
I have two field column TEXT1 and TEXT2. Text2 contains total five item
and text1 contain one item, how I can check Text1 against text2 its
existing or not.
:Text1 :='B1'
:Text2 := 'A1,B1,C1,D1'
I have tried the following way, but it is not working
IF :Text1 IN (:TEXT2) THEN
DISP_MSG('EXIST');
END IF;
Regards,
Jen.

Or
sql>
declare
text1 varchar2(10) := 'B1';
text2 varchar2(20) := 'A1,B1,C1,D1,E1';
begin
dbms_output.put_line(case when text2 like '%'||text1||'%' then 'Exists'
                           else 'Not exists'
                      end );
end;
Exists
PL/SQL procedure successfully completed.
jeneesh                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Similar Messages

  • How i can check this

    Hay Friends..
    in my code i am generating a randum number (rng), Now i want to check TWO conditiond. Is my number LESS THAN EQUALLS TOsomenumber (let say 0.3) and GREATER THAN EQUALLS TO somenumber (let say 0.58)...I M NOT SURE AM I DOING IT WRITE OR NOT,,,Please lemme me know to do it
    if (rng<=.25)
    return 1;
    else if (.25<rng<=.65)
    return 2;
    else if (.65<rng<=.85)
    return 3;
    else (.85<rng<=1)
    return 4;
    }

    http://forums.devshed.com/java-help-9/can-i-use-like-this-364453.html
    // if (number >= lo && number <= hi)Hey! That's my comment! ;-)
    kind regards,
    Jos (c) (tm)

  • How I can change this query, so I can display the name and scores in one r

    How I can change this query, so I can add the ID from the table SPRIDEN
    as of now is giving me what I want:
    1,543     A05     24     A01     24     BAC     24     BAE     24     A02     20     BAM     20in one line but I would like to add the id and name that are stored in the table SPRIDEN
    SELECT sortest_pidm,
           max(decode(rn,1,sortest_tesc_code)) tesc_code1,
           max(decode(rn,1,score)) score1,
           max(decode(rn,2,sortest_tesc_code)) tesc_code2,
           max(decode(rn,2,score)) score2,
           max(decode(rn,3,sortest_tesc_code)) tesc_code3,
           max(decode(rn,3,score))  score3,
           max(decode(rn,4,sortest_tesc_code)) tesc_code4,
           max(decode(rn,4,score))  score4,
           max(decode(rn,5,sortest_tesc_code)) tesc_code5,
           max(decode(rn,5,score))  score5,
           max(decode(rn,6,sortest_tesc_code)) tesc_code6,
           max(decode(rn,6,score))  score6        
      FROM (select sortest_pidm,
                   sortest_tesc_code,
                   score,
                  row_number() over (partition by sortest_pidm order by score desc) rn
              FROM (select sortest_pidm,
                           sortest_tesc_code,
                           max(sortest_test_score) score
                      from sortest,SPRIDEN
                      where
                      SPRIDEN_pidm =SORTEST_PIDM
                    AND   sortest_tesc_code in ('A01','BAE','A02','BAM','A05','BAC')
                     and  sortest_pidm is not null 
                    GROUP BY sortest_pidm, sortest_tesc_code))
                    GROUP BY sortest_pidm;
                   

    Hi,
    That depends on whether spriden_pidm is unique, and on what you want for results.
    Whenever you have a problem, post a little sample data (CREATE TABLE and INSERT statements, relevamnt columns only) for all tables, and the results you want from that data.
    If you can illustrate your problem using commonly available tables (such as those in the scott or hr schemas) then you don't have to post any sample data; just post the results you want.
    Either way, explain how you get those results from that data.
    Always say which version of Oracle you're using.
    It looks like you're doing something similiar to the following.
    Using the emp and dept tables in the scott schema, produce one row of output per department showing the highest salary in each job, for a given set of jobs:
    DEPTNO DNAME          LOC           JOB_1   SAL_1 JOB_2   SAL_2 JOB_3   SAL_3
        20 RESEARCH       DALLAS        ANALYST  3000 MANAGER  2975 CLERK    1100
        10 ACCOUNTING     NEW YORK      MANAGER  2450 CLERK    1300
        30 SALES          CHICAGO       MANAGER  2850 CLERK     950On each row, the jobs are listed in order by the highest salary.
    This seems to be analagous to what you're doing. The roles played by sortest_pidm, sortest_tesc_code and sortest_test_score in your sortest table are played by deptno, job and sal in the emp table. The roles played by spriden_pidm, id and name in your spriden table are played by deptno, dname and loc in the dept table.
    It sounds like you already have something like the query below, that produces the correct output, except that it does not include the dname and loc columns from the dept table.
    SELECT    deptno
    ,       MAX (DECODE (rn, 1, job))     AS job_1
    ,       MAX (DECODE (rn, 1, max_sal))     AS sal_1
    ,       MAX (DECODE (rn, 2, job))     AS job_2
    ,       MAX (DECODE (rn, 2, max_sal))     AS sal_2
    ,       MAX (DECODE (rn, 3, job))     AS job_3
    ,       MAX (DECODE (rn, 3, max_sal))     AS sal_3
    FROM       (
               SELECT    deptno
               ,          job
               ,          max_sal
               ,          ROW_NUMBER () OVER ( PARTITION BY  deptno
                                              ORDER BY          max_sal     DESC
                                )         AS rn
               FROM     (
                             SELECT    e.deptno
                       ,           e.job
                       ,           MAX (e.sal)     AS max_sal
                       FROM      scott.emp        e
                       ,           scott.dept   d
                       WHERE     e.deptno        = d.deptno
                       AND           e.job        IN ('ANALYST', 'CLERK', 'MANAGER')
                       GROUP BY  e.deptno
                       ,           e.job
    GROUP BY  deptno
    ;Since dept.deptno is unique, there will only be one dname and one loc for each deptno, so we can change the query by replacing "deptno" with "deptno, dname, loc" throughout the query (except in the join condition, of course):
    SELECT    deptno, dname, loc                    -- Changed
    ,       MAX (DECODE (rn, 1, job))     AS job_1
    ,       MAX (DECODE (rn, 1, max_sal))     AS sal_1
    ,       MAX (DECODE (rn, 2, job))     AS job_2
    ,       MAX (DECODE (rn, 2, max_sal))     AS sal_2
    ,       MAX (DECODE (rn, 3, job))     AS job_3
    ,       MAX (DECODE (rn, 3, max_sal))     AS sal_3
    FROM       (
               SELECT    deptno, dname, loc          -- Changed
               ,          job
               ,          max_sal
               ,          ROW_NUMBER () OVER ( PARTITION BY  deptno      -- , dname, loc     -- Changed
                                              ORDER BY          max_sal      DESC
                                )         AS rn
               FROM     (
                             SELECT    e.deptno, d.dname, d.loc                    -- Changed
                       ,           e.job
                       ,           MAX (e.sal)     AS max_sal
                       FROM      scott.emp        e
                       ,           scott.dept   d
                       WHERE     e.deptno        = d.deptno
                       AND           e.job        IN ('ANALYST', 'CLERK', 'MANAGER')
                       GROUP BY  e.deptno, d.dname, d.loc                    -- Changed
                       ,           e.job
    GROUP BY  deptno, dname, loc                    -- Changed
    ;Actually, you can keep using just deptno in the analytic PARTITION BY clause. It might be a little more efficient to just use deptno, like I did above, but it won't change the results if you use all 3, if there is only 1 danme and 1 loc per deptno.
    By the way, you don't need so many sub-queries. You're using the inner sub-query to compute the MAX, and the outer sub-query to compute rn. Analytic functions are computed after aggregate fucntions, so you can do both in the same sub-query like this:
    SELECT    deptno, dname, loc
    ,       MAX (DECODE (rn, 1, job))     AS job_1
    ,       MAX (DECODE (rn, 1, max_sal))     AS sal_1
    ,       MAX (DECODE (rn, 2, job))     AS job_2
    ,       MAX (DECODE (rn, 2, max_sal))     AS sal_2
    ,       MAX (DECODE (rn, 3, job))     AS job_3
    ,       MAX (DECODE (rn, 3, max_sal))     AS sal_3
    FROM       (
                   SELECT    e.deptno, d.dname, d.loc
              ,       e.job
              ,       MAX (e.sal)     AS max_sal
              ,       ROW_NUMBER () OVER ( PARTITION BY  e.deptno
                                           ORDER BY       MAX (sal)     DESC
                                          )       AS rn
              FROM      scott.emp    e
              ,       scott.dept   d
              WHERE     e.deptno        = d.deptno
              AND       e.job                IN ('ANALYST', 'CLERK', 'MANAGER')
                  GROUP BY  e.deptno, d.dname, d.loc
              ,       e.job
    GROUP BY  deptno, dname, loc
    ;This will work in Oracle 8.1 and up. In Oracle 11, however, it's better to use the SELECT ... PIVOT feature.

  • I have my iphone 5 but a lost. The box where it came  how i can check  of how many gb its ?

    I have my iphone 5 but a lost. The box where it came  how i can check  of how many gb its ?

    Tap settings
    General
    About
    this provides alist of everything you may need to know about your device

  • I deleted all my playlist by mistake from itunes. tried copying the to on the go on ipod and thought it would copy it on to my itune but it didn't. does any one know how i can do this without redoing all my playlists. thanks

    I deleted all my playlist by mistake from itunes. tried copying them to on the go on ipod and thought it would copy it on to my itune but it didn't. does any one know how i can do this without redoing all my playlists. thanks

    Are the playlists still on the iPod? If so I can probably cook up a script to read them back into iTunes, or you can check the features of the various tools listed at the end of this user tip to see if you can find one that you want to use.
    tt2

  • HT201210 when i want to restre the iphone so i can see an error 3194 how i can solve this problem

    i am trying to restore the iphone through itunes and i can an error which is 3194 so how i can solve this problem

    Check Hosts file of comp. It must point to Apple.
    Would have already seen
    Error 1004, 1013, 1638, 3014, 3194: These errors may be the result of the connection to gs.apple.com being redirected or blocked. Follow these steps to resolve these errors:
    Install the latest version of iTunes.
    Check security software. Ensure that communication to gs.apple.com is allowed. Follow this article for assistance with security software. iTunes for Windows: Troubleshooting security software issues.
    Check the hosts file. The restore will fail if there is an active entry to redirect gs.apple.com. Follow iTunes: Advanced iTunes Store troubleshooting to edit the hosts file or revert to a default hosts file. See section "Blocked by configuration: (Mac OS X/Windows) > Rebuild network information".
    Try to restore from another known-good computer and network.
    If the errors persist on another computer, the device may need service.

  • I want to sync tasks in Outlook with my iPhone. I have tried Toodledo (not good) and Todo. Todo works, but it cuts off most of the text. I only get the beginning of my (long) lists. Any ideas how I can solve this problem?

    I want to sync tasks in Outlook with my iPhone. I have tried Toodledo (not good) and Todo. Todo works, but it cuts off most of the text. I only get the beginning of my (long) lists. Any ideas how I can solve this problem? I starting to regret that I switched to iPhone...

    Usually if you have some kind of hardware failure there is some beeping during POST or most motherboards now have LED indicators to produce and error message based on the type of failure
    So if its bad memory, not place properly, mismatched, processor not inserted properly, mismatched voltage or voltage connector not present etc it beeps or generates the error id.
    Power supplies can be tested for failure. There are some walk throughs for testing just them with a switch, paperclip or a jumper (I'd suggest not doing this if you are not familiar with the dangers of electricity).
    Memory can be tested with memory diagnostics programs like Memtest+
    Processors can overheat if the proper precautions have not been taken usually you will get a POST beep or error code for that.
    If the motherboard has no response then do the basics first:
    Check power connectors and power supply. Once you determine that is not the case move on to other items like graphics cards in all the way or memory.

  • HT1386 I recently bought a new laptop and installed itunes. I was trying to sychronize my ipad and iphone, but it seems that the itunes was unable to recognize the devices. Can you tell me how I can solve this problem?

    I recently bought a new laptop and installed itunes. I was trying to sychronize my ipad and iphone, but it seems that the itunes was unable to recognize the devices. Can you tell me how I can solve this problem?

    how new is the Notebook ?
    Also double check your firewalls and virus protection that they are not blocking any ports also make sure you are plugging in the fastest USB

  • TS1702 i m in china when go to app stores to download say u need go chinese app store dont allow to u to use uk stores how i can solve this problem

    i m in china when go to app stores to download say u need go chinese app store dont allow to u to use uk stores how i can solve this problem

    Morning sawirew,
    Each type of content on the iTunes Store has different availability based on the country in which you reside.
    iTunes Store: Which types of items can I buy in my country?
    http://support.apple.com/kb/ts3599
    iOS: Changing the signed-in iTunes Store Apple ID account
    http://support.apple.com/kb/ht1311
    Change your iTunes Store country
    Sign in to the account for the iTunes Store region you'd like to use. Tap Settings > iTunes & App Stores > Apple ID: > View Apple ID > Country/Region.
    Follow the onscreen process to change your region, agree to the terms and conditions for the region if necessary, and then change your billing information.
    Have a nice day,
    Mario

  • My dvd player will not let me change regions, it just quits when i do, now its stuck on region 1. Any thoughts how i can solve this problem or get round it in some way?

    My dvd player will not let me change regions, it says i have one more chance to change it, then it just quits when i do, now its stuck on region 1. Any thoughts how i can solve this problem or get round it in some way?

    Usually if you have some kind of hardware failure there is some beeping during POST or most motherboards now have LED indicators to produce and error message based on the type of failure
    So if its bad memory, not place properly, mismatched, processor not inserted properly, mismatched voltage or voltage connector not present etc it beeps or generates the error id.
    Power supplies can be tested for failure. There are some walk throughs for testing just them with a switch, paperclip or a jumper (I'd suggest not doing this if you are not familiar with the dangers of electricity).
    Memory can be tested with memory diagnostics programs like Memtest+
    Processors can overheat if the proper precautions have not been taken usually you will get a POST beep or error code for that.
    If the motherboard has no response then do the basics first:
    Check power connectors and power supply. Once you determine that is not the case move on to other items like graphics cards in all the way or memory.

  • When i want to download an app in app store give me an error number and i could not down load.how i can solve this error number?

    When i want to download an app in app store give me an error number and i could not down load.how i can solve this error number?

    Hi Amir.09395340646,
    Welcome to the Support Communities!
    What app are you trying to download? Is it iPhoto for iOS?  What error message are you receiving? The first thing I would suggest is to log out of your iTunes Store account on your iPhone. Then restart the device and log in again. 
    iOS: Changing the signed-in iTunes Store Apple ID account
    http://support.apple.com/kb/HT1311?viewlocale=en_US
    If the above did not resolve your issue, follow the troubleshooting steps in the article below.
    The link includes the complete details and screenshots, but I've highlighted a few points for you:
    Can't connect to the iTunes Store
    http://support.apple.com/kb/TS1368
    - Make sure that your iOS software is up to date by connecting your iOS device to iTunes and clicking on Check for Update in your device's Summary page in iTunes.
    - Check and verify that you are in range of a Wi-Fi router or base station. If you are on a 3G capable device, make sure that cellular data is turned on from Settings > General > Cellular.
    - Check to make sure you have an active internet connection. You can check the User Guide for your device for help with connecting to the internet.
    - Check to make sure other devices (portable computers, for example) are able to connect to the Wi-Fi network and access the internet.
    - Try resetting (turning off and then on again) your Wi-Fi router
    - If the issue still persists see, iOS: Troubleshooting Wi-Fi networks and connections or iOS: Troubleshooting Wi-Fi networks and connections.
    I hope this information helps ....
    - Judy

  • The send button is greyed out when I try to text some but not all people from my iPod touch. Any ideas how I can fix this?

    The send buttin is greyed out when I try to text some but not all people from my iPod Touch. This happens even when they have iPhone 4s. Any ideas why and how I can fix this?

    This issue can be caused by the McAfee SiteAdvisor extension.
    Start Firefox in [[Safe Mode]] to check if one of the add-ons is causing the problem (switch to the DEFAULT theme: Tools > Add-ons > Appearance/Themes).
    * Don't make any changes on the Safe mode start window.
    See:
    * [[Troubleshooting extensions and themes]]

  • How i can check my phone is under warrenty???????

    i want to know, how i can check my phone warrenty period and my phone originallty...........

    Hi krishanjaat
    It would help if you carry out *#0000# and post the results, if you want more help with this matter.
    Happy to have helped forum in a small way with a Support Ratio = 37.0

  • How I can check if my Imac is Intel Core Duo Extreme

    Hello All,
    How I can check if my Imac is truly Intel Core Duo Extreme from Leopard?
    thank you,
    JD

    JD,
    Welcome to Apple Discussions.
    Apple Menu>About This Mac>More Info...>Hardware>Hardware Overview>Processor Name:
    ;~)

  • How I can do this update, when I have two records (one primary key, no seq)

    How I can do this update in pl\sql
    Here is the table with some data
    CREATE TABLE INSERT_TE
    PIDM        VARCHAR2(8),
    FORM_ID     VARCHAR2(2),
    TEACHER     VARCHAR2(30)
    INSERT into INSERT_TE
    PIDM,
    FORM_ID,
    TEACHER
    SELECT
    '1106651',
    'TE',
    'Teacher, Alber Howard'
    from dualcommit;
    INSERT into INSERT_TE
    PIDM,
    FORM_ID,
    TEACHER
    SELECT
    '1106651',
    'TE',
    'Teacher, Alber2 '
    from dualcommit;
    INSERT into INSERT_TE
    PIDM,
    FORM_ID,
    TEACHER
    SELECT
    '2321241',
    'TE',
    'Teacher, Silly Billy '
    from dualcommit
    You are going to ended with something like this: In a cursor..
    PIDM     FORM_ID     TEACHER
    1106651     TE     Teacher, Alber Howard
    1106651     TE     Teacher, Alber2
    2321241     TE     Teacher, Silly Billythen I need to update a table
    if the there is only one record like this one 2321241 TE Teacher, Silly Billy
    not problem I do this
    UPDATE   saturn.sarchkl
             SET
             sarchkl_receive_date = SYSDATE,
             sarchkl_activity_date = SYSDATE,
             sarchkl_source = 'U',
             sarchkl_source_date = SYSDATE
             WHERE
              sarchkl_pidm = v_pidm3
              AND sarchkl_receive_date IS NULL
              AND sarchkl_term_code_entry = p_term
              AND sarchkl_admr_code = 'REC1'But if there is a PIDM (pk) with two records
    PIDM FORM_ID TEACHER
    1106651 TE Teacher, Alber Howard
    1106651 TE Teacher, Alber2 I need to do 2 updates (notice the AND sarchkl_admr_code rec1 for the firs and rec2 for the second
    The first record should update the table when the condition is sarchkl_admr_code = 'REC1' and the second record with the
    condition is sarchkl_admr_code = 'REC2'
    UPDATE   saturn.sarchkl
             SET
             sarchkl_receive_date = SYSDATE,
             sarchkl_activity_date = SYSDATE,
             sarchkl_source = 'U',
             sarchkl_source_date = SYSDATE
             WHERE
              sarchkl_pidm = v_pidm3
              AND sarchkl_receive_date IS NULL
              AND sarchkl_term_code_entry = p_term
              AND sarchkl_admr_code = 'REC1'and
    UPDATE   saturn.sarchkl
             SET
             sarchkl_receive_date = SYSDATE,
             sarchkl_activity_date = SYSDATE,
             sarchkl_source = 'U',
             sarchkl_source_date = SYSDATE
             WHERE
              sarchkl_pidm = v_pidm3
              AND sarchkl_receive_date IS NULL
              AND sarchkl_term_code_entry = p_term
              AND sarchkl_admr_code = 'REC2'I am doing this in pl\sql, I don't have a sequence in the table INSERT_TE, how I know that the first record in
    1106651 TE Teacher, Alber Howard
    1106651 TE Teacher, Alber2 update a rec1 and the second updates when sarchkl_admr_code = 'REC2',
    I guess I can create a sequence, but I am inserting a table from a select satement, I am getting the error
    ORA-02287: sequence number not allowed here, when I try to do the following:
    INSERT INTO SYTEACH
    SYTEACH_PIDM,
    SYTEACH_ID,
    SYTEACH_TEACHER,
    SYTEACH_SEQ
    SELECT  
          DISTINCT
          spriden_pidm,
          sarchkl_admr_code,
          szsform_form_id,
          szsform_schl_off_type||', '||szsform_schl_off_firstname||' '||szsform_schl_off_lasttname teacher,
           SZSFORM_SEQ.NEXTVAL
            FROM   saturn_midd.szsform, saturn.spriden, saturn.sarchkl
           WHERE       spriden_ntyp_code = 'CAPP'
                   AND szsform_common_app_id = spriden_id
                   AND spriden_pidm = sarchkl_pidm
                   AND sarchkl_admr_code = 'REC1'
                   AND szsform_form_id = 'TE'
    What is the simple way of doing this update..

    Hi,
    you said:
    >
    But if there is a PIDM (pk) with two records
    PIDM FORM_ID TEACHER
    1106651 TE Teacher, Alber Howard
    1106651 TE Teacher, Alber2
    >
    No! pks are unique! (otherwise we don't call them pk)
    For your table you could define a unique like this:
    PIDM column + a sequence. (new column):
    ALTER TABLE INSERT_TE ADD(TEACH_SEQ NUMBER)
    UPDATE INSERT_TE x
       SET TEACH_SEQ =
              (SELECT n
               FROM   (SELECT ROWID rid,
                              ROW_NUMBER() OVER(PARTITION BY pidm ORDER BY TEACHER) n
                       FROM   INSERT_TE t) s
               WHERE  s.rid = x.ROWID)
    PIDM     FORM_ID     TEACHER     TEACH_SEQ
    1106651     TE     Teacher, Alber Howard      1
    1106651     TE     Teacher, Alber2       2
    2321241     TE     Teacher, Silly Billy      1I need to do 2 updates (notice the AND sarchkl_admr_code rec1 for the firs and rec2 for the second
    The first record should update the table when the condition is sarchkl_admr_code = 'REC1' and the second record with the condition is sarchkl_admr_code = 'REC2'
    >
    normally no.
    but you can (now) do
    select PIDM, FORM_ID, TEACHER, 'REC'||TEACH_SEQ TEACH_SEQ from INSERT_TE
    PIDM     FORM_ID     TEACHER     TEACH_SEQ
    1106651     TE     Teacher, Alber Howard     REC1
    1106651     TE     Teacher, Alber2      REC2
    2321241     TE     Teacher, Silly Billy      REC1and use the last column for you update ...
    Edited by: user11268895 on Aug 20, 2010 2:01 PM

Maybe you are looking for

  • Missing files in System and preferences not working.

    I was trying to launch the system preferences the other day but could not get the window to appear. The selection is under the apple toolbar , but clicking on it does nothing. So I decided to try to launch it from the system folder. Surprise, the onl

  • Appmenu-qt causeing trouble since KDE 4.9.5

    Hey guys, I just updated to KDE 4.9.5 just to discover that having appmenu-qt installed (I don't use it) makes menu bars go to nirvana. I simply uninstalled the package and the menu bars appeared again. Someone else experiencing the same issue? The p

  • CS5 Print Booklet is not generating a booklet. How can I work around this?

    I have updated to CS5 and now when I use  "print Booklet" for my 12 page inDesign document, no pdf is produced. In CS3, the pdf appeared with no problem, ready to take to the printer, all spreads ready for saddle stitch printing on ledger paper. I ca

  • TOC caching issue on IE

    Hello all RH10 to webhelp I just received a call from an ongoing client. He's reporting that they are experiencing TOC caching issues in IE only. A topic and a book in the TOC that we removed in the latest updates are still appearing in the TOC, but

  • Pauses in Playback

    For the past week or so I have had random hiccups in playback which is being streamed from my iMac that last just a few seconds. I have all the latest updates available. My ATV is hardwired via an Airport Extreme, which even the update today didn't h