Error calculation page - help?

I have a problem with my sql on a calculation of page - can I get some suggestions?

I get the following error,
PLS-00103: encountered the symbol "SELECT" when expecting one of the following numbers: (- + case new mod...)

Point page P3_ACCOUNT is updated by calculation after submit
Body of the PL/SQL function
declare 
  v_account varchar2(50);
Begin
IF      
(select account from assignments where emplid = :P2_ID
     and end_dt is null) like 'BENCH'
     then v_account:='BENCH';
     
ELSIF     
(select count(account) from assignments where emplid = :P2_ID
     and end_dt is null)>1
     then v_account:='LEVERAGED';
     
ELSE    
v_account:=(select account from assignments where emplid = :P2_ID
     and end_dt is null);

END IF;

return v_account;

End;
As you can probably, I read the "assignments" table for all values of 'account' where the 'end_dt' in the folder is set to null. This sometimes means multiple selected records, whereby case -.
If one is "BENCH", then return "BENCH".
ElseIf there is more than one record is returned, return "LEVERAGED".
otherwise return some 'account' is (single record returned)

I appreciate your help.

Rich

Hello

Don't think that you can make statements like this example of direct comparisons with sql statements.

Best place to first store the result in a variable.

e.g. select count (*) in the table v_count where conditions; If v_count > 1 then etc.

http://www.java2s.com/Tutorial/Oracle/0440__PL-SQL-statements/Selectcountvalueintoavariable.htm

Van
Trent

Tags: Database

Similar Questions

  • error on page message appearing frequently

    I was referred to as your division of someone on the Hotmail Forum we seem not to be able to solve the problem.  Often, when I go to a website (for example, Starbucks, for example) store and need to ask a question or have reasons to use their own format for my application or order, I will type the appropriate data and click on 'send' and immediately see 'error on page' and the message cannot be transmitted.  This does not work when I send messages directly from my Outlook account but almost 100% necessary to communicate with an entity on their own page and send it from this web page.

    Hi Laurie Post,.

    Thanks for posting your query in the Microsoft Community. Provide the following information for a better understanding of the issue:

    ·         What is the full error message?

    ·         The problem occurs with all Web sites?

    ·         Did you do changes on the computer before the show?

    ·         You use Internet Explorer? If so, what version are you using?

    ·         Are you talking to your Hotmail account?

    Answer with the information required to help more.

  • "error on page".

    What is originally an "error on page" message when I try to send an email to a company such as LinkedIn Help Desk or a cargo mover website.

    It's a problem with the forms of submission on the web pages that you use, not Outlook.  I'll pass this on the forums of Windows and see if someone might know what is happening.

  • I have windows live hotmail on Vista.Problem is that this message, 'error on page' appears on the lower left and no emails will be open and I can't change pages. How do you find / fix 'error on page '?

    I have windows live hotmail on Vista. New problem is the error message, 'error on page' appears at the bottom left. As a result I can't open any email or forward to other pages of e-mail. How does a find/fix 'error on page '?

    Hello

    ·        What browser do you use to connect to the internet?

    ·        The issue is with Hotmail?

    If the question is only limited to Hotmail then confirm your request in the forum Hotmail for assistance:

    Windows Live Solution Center Hotmail Portal

    http://windowslivehelp.com/product.aspx?ProductID=1

    If you use Internet Explorer, then you can try the steps from the link and check if it helps:

    What should you do about Internet Explorer script errors?

    http://Windows.Microsoft.com/en-us/Windows-Vista/what-should-you-do-about-Internet-Explorer-script-errors

  • while I'm clicking on download to download the software nymgo or actionvoip the error "this page cannot be opened.

    while I'm clicking on download to download nymgo or software actionvoip the error "this page cannot be opened" I use window7.

    Hello

    1. where you are trying to download the software from?

    2. what mobile phone you are using?

    3. what web browser do you use?

    4. What is the full error message that you receive?

    5. are you able to download other programs without any problem?

    If the problem only occurs with the Nymgo software download, I suggest you contact Nymgo support for assistance.

    Hope the helps of information.

  • I can't connect to Adobe Creative Cloud. (Error code: 201) Help "."

    I am unable to connect to the VAC. This error keeps coming up when I open the VAC and it loads in 2% and stops: "there seems to be a problem with the download of the file. For troubleshooting tips, please visit our customer service page. (Error code: 201) Help "."

    If anyone can help?

    uninstall your office cc application. »

    Restart your computer

    clean through the use of the Adobe Creative Cloud cleaning tool to solve installation problems

    Restart your computer

    install the cc desktop application, use of the desktop application cloud creative to manage your applications and services

  • I got this message: error. Page cannot be displayed. For more details, please contact your service provider. (9)

    When I tried to access the site stationeryheaven.com , I have a white page with this error message. Error. Page cannot be displayed. For more details, please contact your service provider. (9)
    It has been long since I have been on this site, but why I would get a message like this?
    INIE

    Broken website, same error here on FF or IE.

  • "Error on page" while he was playing msn games online

    OP:msnonlinefreegames, errorpn page
    I recently bought a HP 64-bit with Windowsw 7 computer.  Whenever I try to sign up for Msn games online fre.  I can't BRING simply DOWNLOAD 'ERROR REF PAge'.  What's wrong

    Hi ggmawinton,
    1. don't you get the error only when you play msn games online or with other Web pages as well?
    2 had to play msn games online before with no problems?
    3. what browser do you use?

    The "error on page" or "Completed with error on page" message does not indicate a problem with a local computer. It occurs when an element on a Web page is not correctly built by the creator of the page.
    However, there are many reasons why "Error on page" will occur. For example, you can experience the "Error on page" message when Internet Explorer is unable to read something that is on the web page you are trying to access. If the only sign of a problem is the error message, and Web sites are working, you can probably ignore the error

    The navigation software loads the text, images, animations, and links in the memory (RAM) of your computer. When it encounters something that was not built properly, usually in the Java programming language, it generates the error message.

    In addition, if the problem only occurs on one or two Web pages, it can be a problem with these pages. If you decide to ignore errors, you can disable script debugging.

    Note If this problem occurs on more than one or two sites, do not disable script debugging. Instead, proceed to the next method.

    Method 1:
    To disable notification of every script error in Internet Explorer 8, follow these steps:
    a. open Internet Explorer.
    b. click on the Tools menu, click Internet Options.
    c. on the Advanced tab, click to clear the display a notification of each error in script box and then click OK.
    Method 2:
    Verify that Active Scripting, ActiveX, and Java are not blocked by Internet Explorer. Active scripting, ActiveX, and Java are all involved in shaping the way information displays on a Web page. If they are blocked on your computer, it can disrupt the display of the Web page. Reset the Internet Explorer security settings to ensure that they are not blocked. To do this, follow these steps:
    a. start Internet Explorer.
    b. on the Tools menu, click Internet Options.
    c. in the Internet Options dialog box, click the Security tab.
    d. click on default level.
    e. click OK.
    Note: ActiveX controls and Java programs are disabled in the high security level in Internet Explorer.

    Check out the link for more information below:
    How to fix script errors in Internet Explorer on Windows computers?
    http://support.Microsoft.com/kb/308260
    Kind regards
    Manasa P - Microsoft technical support.

  • I have a problem whit security for Microsoft Works 8 (KB977304), appear always 646 error Code? Help, please!

    I have a problem whit security for Microsoft Works 8 (KB977304), appear always 646 error Code? Help, please!

    Hello

    1. what operating system do you use?
    2 are you able to install all other updates on your computer?
    Try to download and install the update from the link below and check for the issue.
    http://www.Microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=807426a1-8b78-4681-A606-dc39f4d7b64a
    For more information visit http://support.microsoft.com/kb/977304
    I hope this helps.

    Thanks and greetings
    Umesh P - Microsoft technical support.

    Visit our Microsoft answers feedback Forum and let us know what you think.
    [If this post can help solve your problem, please click the 'Mark as answer' or 'Useful' at the top of this message.] [Marking a post as answer, or relatively useful, you help others find the answer more quickly.]

  • Computer Mangement.lnk unspecified error. Please help me by saying its cause and what could be the solution for it.

    Computer Mangement.lnk unspecified error. Please help me by saying its cause and what could be the solution for it.

    Clear the error on windows server 2008. All of the above files are locked.  We maintain active directory on and it is also not working.

    Help, please.

    Hello

    I suggest you to ask your question at the following link.

    http://social.technet.Microsoft.com/forums/en-us/w7itpronetworking/

    I would also ask you to contact your IT Department for further explanations.

    I hope this helps.

  • In Hotmail, after the sign in still displays this 'error on page', cannot check emails

    In the hotmail after sign in poster always this "error on page."

    Can't check mail except subjects, why?

    Hi uWynn N O.

    Thanks for posting your question in the Microsoft answers Forum. For any question on Hotmail, please visit the following link:

    http://windowslivehelp.com/forums.aspx?ProductID=1

  • A registry errors will set help to speed up my computer?

    For me, it was suggested that the registry errors correction would help to speed up my computer. I am reluctant to download anything on the internet that I don't know. Should I bother even doing this and, if so, is there a known Microsoft product that I can download for this?

    What are the mistakes 'register' you know you have?

  • error 8024001F can help vista 07

    Separated from this thread.

    Please post requests for moderation here.

    Please keep on topic.

    Thank you

    David

    error 8024001F can help vista 07

    Run Windows update Troubleshooter:

    Description of the Windows Update troubleshooting tool

  • not able to update, it says: error WindowsUpdate_8024402f please help

    not able to update, it says: error WindowsUpdate_8024402f please help

    http://Windows.Microsoft.com/en-us/Windows7/Windows-Update-error-80244016-8024402f-or-c80003fa>

    UTC/GMT is 17:37 on Sunday, May 13, 2012

  • Impossible says windows error 80070641 please help update

    Impossible says windows error 80070641 please help update

    I suggest you follow the steps in the link below and check if it helps:

    How to resolve problems connecting to Windows Update or Microsoft Update

    http://support.Microsoft.com/kb/818018/en-us>

    04/21 / 1110:44: 23 pm

Maybe you are looking for

  • White single web page

    HelloI love Firefox, but a page does not load.I just see the word 'Fact' at the bottom left of the page and a white, white screen. Loading the page perfectly using Chrome and IE8. All the browsers on auto update. It's exactly the same thing on anothe

  • Malware for iPad

    Y at - it a malicious software like Malwarebites for iPad application and is it necessary? Where can I find the application?

  • Satellite L300D-13s - disk drive will eject when booting on battery

    When to start my Satellite L300D-13 s on power electric battery drive ejects when starting upwards and then he won t keep any kind of CD, DVD or CD-rom discs however it works fine when starting on the grid. The battery is fully charged and there is n

  • Notifier behavior strange (but may be correct)

    Hi all I have a VI that allows to run two tasks A and B. The tasks are run one after the other, never at the same time, regardless of the order (A-> B-> A or B can happen). Usually I use the registrants to stop my tasks and here I wanted to use the n

  • How get rid you of a virus on windows xp that addresses your computer from all directions?

    OK, so I got this virus on my pc for some time now.  First I start my pc as usual, it starts as usual.  Then a few seconds later the background picture on my desk blue towers, more seconds after a program called "MS Removal Tool" is running a program