Strange decode or just Strange Day (for me)

Hi,
Why does this work:
SQL> ed
Wrote file afiedt.buf
1 declare
2 p_cont varchar2(1) := 'C';
3 v_x VARCHAR2(1) := NULL;
4 CURSOR chek_p_cont
5 IS
6 SELECT 'X'
7 FROM dual
8 WHERE p_cont = DECODE (
9 p_cont, 'A'--,'A'
10 , p_cont, 'B'--,'B'
11 , p_cont, 'C'--,'C'
12 , p_cont, 'D'--,'D'
13 , p_cont, 'E'--,'E'
14 );
15 begin
16 open chek_p_cont;
17 FETCH chek_p_cont
18 INTO v_x;
19 if ( chek_p_cont%FOUND ) THEN dbms_output.put_line('trus');
20 end if;
21* end;
SQL> /
trus
PL/SQL procedure successfully completed.
SQL>
And this does not:
SQL> l
1 declare
2 p_cont varchar2(1) := 'C';
3 v_x VARCHAR2(1) := NULL;
4 CURSOR chek_p_cont
5 IS
6 SELECT 'X'
7 FROM dual
8 WHERE p_cont = DECODE (
9 p_cont, 'A','A'
10 , p_cont, 'B','B'
11 , p_cont, 'C','C'
12 , p_cont, 'D','D'
13 , p_cont, 'E','E'
14 );
15 begin
16 open chek_p_cont;
17 FETCH chek_p_cont
18 INTO v_x;
19 if ( chek_p_cont%FOUND ) THEN dbms_output.put_line('trus');
20 end if;
21* end;
SQL> /
PL/SQL procedure successfully completed.
SQL>
Am i missing something here guys .
thanks
n.

In the first Decode you are saying
IF p_cont = 'A' then return p_cont
ELSIF p_cont = 'B' then return p_cont
ELSIF p_cont = 'C' then return p_cont
ELSIF p_cont = 'D' then return p_cont
ELSIF p_cont = 'E' then return p_cont
END IF;
In the second I'm not sure what you are trying to say. But it does not make sense. Here is some of it
IF p_cont = 'A' then return 'A'
elsif p_cont = p_cont then return 'B'
The DECODE works as follows
Decode( p_val ,
              'A' , 'ONE'
              'B' , 'TWO',
              'NONE' ) ;IF p_val = 'A' then 'ONE'
elsif p_val = 'B' then 'TWO'
else 'NONE'
end if;
If only takes one parameter and does the compare(s) and returns a value. To test what will be returned from the decode put it as a column in the query.

Similar Messages

  • PowerBook G4 - Won't Start Up - 3 Strange Beeps then just LED flashes and sudden death - black screen.

    PowerBook G4 - Won't Start Up - 3 Strange Beeps then just LED flashes and sudden death - black screen.
    Prior that the powerbook also couldn't start but I could see the Apple logo, so via fire-wire (holding T at start up) I backed up the hard disk.
    Check via DiskToolPro the structure, defragmented. Via DiskWarrior rebuild the directory
    and finally not been able to access the drive I reformatted the drive via fire-wire drive.
    Re-started the powerbook holding C to boot up from DVD - nothing
    Re-started again and it give me one long beep and black screen. An indication that my 1gig RAM is bad or gone (?) and the DVD is stuck inside.
    Bought new one 1 gig, installed it and now I'm getting only three beeps.
    I tried all, changed the slots several times and nothing.
    I tried more as:
                             c -- to boot from CD (again while the DVD is still inside and I cannot get it out)
                             cmd-opt-p-r -- to Zap the PRAM,
                             cmd-opt-n-v -- to clear NV RAM,
                             cmd-opt-o-f -- to boot into open firmware … and nothing. The DVD is in and I have 
                                                    black screen with three beeps and flashing LED.
    Do I have to replace the Logic Board?   (Anyone has a spare one ?)
    But it is the faulty Logic board?
    Could anyone help me out? Please.
    I'm retired and I cannot afford a new laptop - and this powerbook was a great, great horse for me until that horrible set of three beeps.
    Thank you in advance for any advice and help.
    Martin
    THE SPECS OF MY POWERBOOK:
    Model Family:
    Powerbook G4 Aluminum
    Processor:
    1.67GHz G4 (PowerPC 7457B)
    Manufacturer:
    Motorola
    # of CPUs:
    1
    Codename:
    Apollo 7
    Display:
    Size:
    15.2"
    Finish:
    Matte
    Resolution:
    1280x854
    Backlight:
    CCFL
    Base Memory:
    1gig PC2700 SODIMM
    Brand:
    Apple
    Wireless:
    802.11b/g
    Color(s):
    Aluminum
    Original OS:
    Mac OS X 10.6.3
    Battery:
    50-watt-hour removable lithium-ion battery
    Graphics:
    ATI Mobility Radeon 9700 (64MB)
    Base Storage:
    80GB 5400RPM EIDE 2.5"
    Optical Drive:
    8x Superdrive
    Model Number:
    A1106
    Sales Number(s):
    M9677LL/A
    Machine Number(s):
    PowerBook5,6
    Dimensions:
    13.7 in x 9.5 in x 1.1 in
    Weight:
    5.6 lb
    Production:
    Jan 31, 2005 - Oct 19, 2005
    Factory:
    China
    Production Year:
    2005
    Production Week:
    35 (September)
    Production Number:
    4240

    But it is the faulty Logic board?
    There was a known issue with LBs in 15-inch PowerBooks with 1.5 and 1.67Ghz processors in which one RAM slot would fail. There once was a repair extension program that fixed the problem at no cost, but it is long-expired.
    The problem with seeking a used logic board for these models is that so many had their boards replaced that it increases the chances of the boards in the used/pulled markets having the same problem you have now. The replacement program also came close to exhausting the supply of new boards,
    If it turns out to be a bad LB and you can't find a replacement, consider how used computer pricing works: A used computer is worth hugely more in parts than if bought as a working unit. I.E, you can probably find a working PowerBook that will cost less than the logic bard alone. It also possible to find a used MacBook Pro for less that a replacement LB.
    If you tell us your approximate geographic location, we can see what's available nearby. I'm also retired, and and visiting my wife's family this week so have even more time than usual to help you search.
    Regards,
    Allan Jones

  • Ios 5 Update New Features says that iCal now has a week view for iPhone but after updating last weekend, I don't see any week view--just List, Day and Month..How do I get the week view?

    ios 5 Update New Features says that calendar now has a week view but after updating my iPhone 4 last weekend, I don't see any week view for iCal--just List, Day and Month as in the past. Is the weekly view available for iCal and if so, how do I access it?

    Rotate your phone to landscape.

  • Hi, I m using an iPhone 4 and my yahoo push email was working just fine but for the last few days I am experiencing some problem that is the emails are not getting pushed , I have to manually fetch the mails. So what could be the reason for this....

    Hi, I m using an iPhone 4 and my yahoo push email was working just fine but for the last few days I am experiencing some problem that is the emails are not getting pushed , I have to manually fetch the mails. So what could be the reason for this.....I have set the email setting to "push" mode. Moreover I can't edit the mail server address ....current it's on Yahoo SMTP server

    Will it get rectified and restored...if so after how long. What could be the reason for such outage kindly share,  as I am facing real problem because of this...

  • When i try to activate iMessage i could see the comment "waiting for activation" for more than 24hrs.Is this because of mobile device problem or someother issue ? My mobile is just 20 days old

    When i try to activate iMessage i could see the comment "waiting for activation" for more than 24hrs.
    Is this because of mobile device problem or someother issue ?
    My mobile is just 20 days old

    The following discusses that error message and may help: iOS: Troubleshooting FaceTime and iMessage activation

  • Bought i phone 6 64 GB just 3 days before performance is very bad.Couldn't even open app store it takes too much time for opening a web page.

    bought i phone 6 64 GB just 3 days before performance is very bad.Couldn't even open app store it takes too much time for opening a web page.

    You may need to reset your network settings, making sure the network you're accessing is stable: tap Settings > General > Reset > Reset Network Settings.
    If your iPhone still can't connect to App Store, tap Settings > iTunes & App Store > tap the Apple ID and sign out > later, sign in with your Apple ID.

  • Strange behaviour of Removal of Alpha for Info object in Quality system

    Strange behaviour of Removal of Alpha for Info object in Quality system as compared to Development system.
    Hi,
    The data for an info object Key in the DSO was 00000000000000000000000000123. I removed Alpha for the info object and data was corrected to 123 in the DSO in development system.
    Now, when i transported the info object without alpha to quality and loaded data into DSO, the data is still the same with leading zeros.
    I dont want to write routine to remove leading zeros, as I have values as 0. If i write routine, all zeros will be removed and this will be blank.
    Both development and quality have same patches applied and are on same level.
    Why is this strange behaviour in quality system...
    Any inputs?? please suggest.
    Thanks.
    Lavanya

    Hi,
      Did you drop and reload the data after changing the conversion?
    Regards,
    Raghavendra.

  • Why need to charge iphone 6 Plus everyday the battery just last long for a day- My phone just 1 week old

    I have to charge my phone everyday, The battery just last long for a day. Is that normal ? My phone just one week old.
    Please advise mates.

    I would say that is well within the acceptable limits,
    If you check out Apple's page here: http://www.apple.com/iphone-6/specs/
    All the way at the bottom is the battery info. It states that you'll get up to 12 hours of battery on 3G/LTE. Of course, that number is obtained by following a very specific set of steps - the real world number is less.
    ~Lyssa

  • LOVE Firefox! I have just launched a website. One designer told me it takes 7-10 days for any changes to appear. Why? I have cleared caches and cookies etc. I need to be more responsive than 7-1o days. I need changes to appear within 24hrs.

    LOVE Firefox! I have just launched a website: www.animalhealingandhumans.com. My web designer told me it takes 7-10 days for any changes to appear. Why? I have cleared caches and cookies etc. I need to be more responsive than 7-1o days. I need changes to appear within 24hrs. How can I achieve a much better response time to good feedback?

    Hello binbingogoABC,
    Shopping on BestBuy.com should be easy and fun and not fraught with the kind of trouble that you describe. I regret very much that this has been your experience.
    Using the information you provided when you signed up for Best Buy Unboxed I was able to locate your cancelled orders. I have requested more information from my back-office partners. As soon as I have additional details about your situation, I will reply again to this message. In the interim, I'm sorry that I must impose upon your patience.
    I'm very grateful that you wrote to us with your concerns.
    Sincerely,

  • TS1702 Has anyone else had this problem? Been waiting for 2 days for an app from apple store to install on my iPad. It just keeps saying "installing" have tried to update other apps at the same time and that happens is the app icons continue to display "w

    I have been waiting for two days for an app to install on my iPad. Seems like something is stuck as it just keeps displaying "installing". Can not see where I can delete and start over and it's preventing me from updating or downloading any more games. Acts like a corrupt file or something. Can anyone help solve this problem? Thanks

    Did anyone ever suggest you reset your PRAM?
    http://docs.info.apple.com/article.html?artnum=2238
    Also might want to try resetting the SMC, although I
    doubt there's an issue there.
    http://docs.info.apple.com/article.html?artnum=304123
    I'm getting tired of people who supposedly know what
    they're doing simply guessing that resinstalling the
    OS might solve the issue. It's like trying to dissect
    a frog with a sledge hammer, and wondering why you
    didn't learn anything about anatomy in the process.
    These sorts of things, although bizarre, should be
    (and probably are) fixable without major surgery.
    Thanks for the suggestion... but I think my first question would be why these parameters would need re-setting? This is a new machine... It has never been shut down hard. It is used at most 10 hours per week... mostly using Office 2004 for MAC. I need to figure this out as I will soon need it as a Cs2/CS3 - Aperture workhorse.
    I too agree that it is best not to use a sledge when a scalpel is needed... but as a novice to the MAC world I may have been misled by Apple support. I seems to have fixed the symptoms ( some) but appears NOT to have addressed the cause... which is what I am after.
    Would TechTool Pro detect a bad HD or RAM?
    Thanks....

  • Trying to download and keep getting message saying my Apple ID has been disabled but I can log into store, etc... I went to the support site buit no help. I emailed but said would take 2-4 days for response. I just wanna listen to my music!!

    Trying to download my music on a new PC. I've authorized PC and can log into store, etc.. But won't let me download. Says Apple ID disabled. No help on support site. I emailed but will take 2-4 days for response.

    We are all itunes users just like you
    You are not addressing Apple here at all
    You need to contact itunes support:
    http://www.apple.com/support/contact/

  • LENOVO S300 LAPTOP LCD PANEL MANUFACTURING DEFECT ISSUE-REQUEST FOR DOA AS LAPTOP IS JUST 6 DAYS OLD

    Dear Lenovo service team,
    This is to inform you that I have purchased a Lenovo laptop from Kolkata dealer called Balaji solutions ltd.Bill no E02PSI120xxxxx Date of purchase is 27/02/2013 @ 7.30 pm Model no Lenovo s300,Sr no: xxxxxxxx.
    As it is a dos machine windows was not installed there after purchasing the laptop i have installed the software on 2.03.2013and i saw that a line wave is coming on my LCD screen.and i have called to customercare @ 180030029929 and one of your executive has told me that it is a issue of software not of the laptop,he suggest me to install the software once again .then i have installed the software once again but the same problem was there after that on 5/03/2012 i go to the dealer and told my problem and they said they cant change the laptop and suggested me to go to service centre today i go to service centre at DIGITAL CARE PVT LTD. and one of the engineer named Mr t has checked the laptop and told me" it is a problem of LCD panel and it is a manufacturing defect".The LCD have to change . The problem is a manufacturing defect then why should i repair it????.The laptop is just 6 days old and why i would take a repaired one?? Either you people replace the laptop from your end or make it a DOA that i can change it from dealer end or suggest the dealer to replace it. i have spend 30,700 rs for a new one and if it comes a manufacturing defect then you people are liable to replace it out.
    Request you please solve this issue as soon as possible. I will not repair it as it has a manufacturing defect it if will use it for 6-7 month i will think to repair but i will not take a repair one as it is just 6 days old and it is a manufacturing fault.
    Please reply soon for this issue or suggest the dealer to replace or make it a DOA from your end.
     CASE ID: 42706xxxxx
    SR.NO OF LENOVO S300: xxxxxxxx
    DATE OF PURCHASE: 27/2/2013
    BILL NO: E02PSI120xxxxx
    DEALERS NAME: BALAJI SOLUTIONS LTD
    Regards,
    Sudipta kar
    Moderator Note; s/n and information which should not be posted openly edited for member's own protection

    Can you take a photo of the damage? Once before I saw an LCD that arrived truly internally cracked. The ink was in a perfect circle, writing off any user fault.
    In the worst case situation, it might be worthwhile to call Lenovo and purchase a new screen. If you purchase one through them, you can get warranty support for the new screen. I realize that is a terrible alternative, as you should not have to invest more money, but it is the cheapest route to get a functioning LCD.
    ←↑→↓↘↙↖↗←↑→↓↘↙↖↗←↑→↓↘↙↖↗←↑→↓↘↙↖↗←↑→↓↘↙↖↗←↑→↓↘↙↖↗←↑→↓↘↙↖↗←↑→↓↘↙↖↗←↑→↓↘↙↖↗
    Tap that kudos button if I helped ^^
    ←↑→↓↘↙↖↗←↑→↓↘↙↖↗←↑→↓↘↙↖↗←↑→↓↘↙↖↗←↑→↓↘↙↖↗←↑→↓↘↙↖↗←↑→↓↘↙↖↗←↑→↓↘↙↖↗←↑→↓↘↙↖↗

  • We have 3 iphones in my family. With the new upgrade 5.1 all the batteries last for just half day in normal use. The same problems happens to a lot fo friends after the upgrade! Is it possible to remove the problem?? Thanks. Mauro, Italy.

    We have 3 iphones in my family. With the new upgrade 5.1 all the batteries last for just half day in normal use. The same problem happens t a lot of friends of mine after the upgrade. Is it possible to remove the problem??? Thanx!

    We have 3 iphones in my family. With the new upgrade 5.1 all the batteries last for just half day in normal use. The same problem happens t a lot of friends of mine after the upgrade. Is it possible to remove the problem??? Thanx!

  • Strange behavior of KEY-LISTVAL trigger for date field

    The code down lead to next behaviour:
    - When I use the List of Value (LOV) fil the field up with a sysdate.
    I choose one period from the LOV, but the field becomes empty.
    /* CGAP$OLES_SEQUENCE_BEFORE */
    declare
    l_cursor_item VARCHAR2(200) := :system.cursor_item;
    l_null_value BOOLEAN := false;
    begin
    if :system.cursor_value is null
    then
    copy(sysdate,l_cursor_item);
    l_null_value := true;
    end if;
    qms$calendar.key_listval;
    if l_null_value
    then
    copy(null,l_cursor_item);
    end if;
    end;
    It seems logical behavior of this code.
    But I don't understand why Headstart 6.5.4.0. generated this code.
    Headstart version 6.5.0 hasn't this code. There it is simply:
    /* CGAP$OLES_SEQUENCE_BEFORE */
    begin
    qms$calendar.key_listval;
    end;

    HI,
    After I save the entries - I see them on the layout. Then I exit bps0 and entr it again, re-launch the layout and don't see anything - just empty cells for the dates and 0s for the amounts. When I change the Characteristics combinations from "All possible characteristics combinations" to "From Transaction Data" I start seeing the entered values. How could I possibly continue on using All possible characteristics combinations and still see the entered values?
    Best regards,
    Andrey

  • Hello.I have purchased a black 32gb iPhone 4 just two days back.Yesterday while putting my phone on charge,I noticed a deep thin scratch on the antenna in a straight line starting from the charging point to the speakers.Is it a manufacturing fault?

    Hello.I have purchased a black 32gb iPhone 4 just two days back.Yesterday while putting my phone on charge,I noticed a deep thin scratch on the antenna in a straight line starting from the charging point to the speakers.Is it a manufacturing fault?The scratch is quiet strange.It's a thin straight line,which I initially mistook to be a design.Can anyone tell me what it is?

    All warranty issues including manufacturing defects, are determined and handled by the Apple Genius. If your iPhone has any problem, contact Apple and they will solve the issue.
    "deep thin scratch on the antenna in a straight line starting from the charging point to the speakers"..... The only thing between the charging port and the speakers is a small screw on both sides of the port?

Maybe you are looking for

  • Want to use Apple TV to serve existing 4 room wired speaker installation

    I purchased a home with existing 4 room speaker system.  All wires terminate in basement where previous owner had some type of media control center.  Each speaker zone has control for volume in the various rooms. My goal is to reconnect the speakers

  • How do I know if my contract is being bought out?

    There are some people in my area who have been receiving mail stating their contract is being bought out by AT&T. I have not received any correspondence regarding this. However, when I am on the Verizon wireless website it directs my to a page statin

  • I can't export .oam files any more. What gives? A big bad bug? Anyone got a work around?

    I was doing great with Edge until last night...when the .oam publishing feature vanished. I'm pasting small animations into my Muse pages, so this was a great thing, in theory, anyway. Tried restarting the app, tried restarting the computer, always o

  • My podcast artwork is not showing up... please help!

    Hi there.  I have submitted my podcast to iTunes and received the email almost a week ago that it was accepted.  It is showing up in iTunes, but the artwork is not showing up and I have no clue what to do to make it show up properly. Here is my xml f

  • Find data where data not in ref cursor

    CREATE OR REPLACE PACKAGE types AS TYPE weak_ref_cursor IS REF CURSOR; END types; CREATE OR REPLACE PROCEDURE procedure_name (p_getname OUT types.weak_ref_cursor, p_tablename IN VARCHAR2, p_salary IN NUMBER) AS v_tem VARCHAR2 (4000); BEGIN v_tem := '