SQL - how to sort and filter a certain number of courses by using a setting

Hello I am using Oracle 11 g 2 SQL in TOAD Version 11.5.1.1.2 editor

I try to view all course numbers for my classroom that has the following conditions: only if the user specifies the code "adg" in parameter: programcode otherwise it will show all courses.

##A###
##C###
##N###
##Q###

Where the third character of my number of course must be a (A, C, N, Q).

However, I get the following error [error] performance (71:39): ORA-00907: lack the right parenthesis

Select course_number
classroom
where course_number = (case when: programcode is null then to another course_number (case when: programcode as 'adg' then))
(course_number LIKE '__Une %' OR)
course_number LIKE '% __C' OR
course_number LIKE '% __N' OR
course_number LIKE '% __Q') ELSE NULL END END))


Help will be greatly appreciated... Thank you!

Hello

That's what you asked for:

SELECT  course_number
FROM      classroom
WHERE      NVL (:programcode, 'ok')     != 'adg'
OR     SUBSTR (course_number, 3, 1)     IN ('A', 'C', 'N', 'Q')
;

If you are intersested in what caused the error in the code you posted, it helps to format your code, while each "(" s'aligne sur sa droite de correspondance") left ', each CASE is aligned with its corresponding END and so forth:"

Select  course_number
from      classroom
where      course_number = (
                       case
                           when  :programcode is null
                     then  course_number
                     else (
                               case
                                   when :programcode like 'adg'          -- No point in using LIKE without a wild card
                               then (
                                    course_number LIKE '__A%' OR     -- What value is this?
                                           course_number LIKE '__C%' OR
                                     course_number LIKE '__N%' OR
                                     course_number LIKE '__Q%'
                               )
                          ELSE NULL
                         END
                 END                -- This should be a line later
                          )      -- This should be a line earlier
                  )

If you would care to post some sample data (CREATE TABLE and INSERT and something instructions for: programcode) then I could test it.

The error was caused by the evil place ")" towards the end of the month. The outside CASE keyword was within 1 pair of parentheses, but its corresponding END was within 2 games.
If you have solved that, you would get another error because of the inner CASE expression. Remember, each WHEN clause has to return a value in one of the types of SQL, such as NUMBER or VARCHAR2 data. What is the value in this data type SQL is returned by internally WHEN?

Tags: Database

Similar Questions

  • How to sort and organize the desktop icons in Windows Vista?

    How do sort you the icons on the desktop by name or lock the desktop under Vista icons

    Right-click on the desktop and click view.
    To get the icons to stay where it is placed on the desktop.
    Click on align on the grid and automatic uncheck their reorganization.

    To have the icon to align with the grid
    This will keep the icons of overlap between them.
    Click on snap to grid.

    To have the icons align automatically:
    The icons will be automatically aligned in the upper left corner of the office.
    Click Auto arrange.

    Not sure if that's what you are meaning.
    Let us know if that helps.

    Marilyn

  • How to copy and paste text from a website read chrome using the Xperia z3v?

    I've searched high and low for a way to copy and paste text from a website in Chrome using the Xperia z3v.  I tried a long tap, double tap, a triple tap - nothing works.

    I am able to select text, copy and paste into a Word doc, however.  There must be a way to do this on a website in Chrome. I am sure that I don't mean to select text that is really an image. I'm trying to copy some text. Here is the link where I try to get the text. It's a recipe.

    http://www.foodnetwork.com/recipes/REE-Drummond/mushroom-pilaf.html#!

    Maybe I should try to get Firefox for smart phones and see if it works.

    Any ideas?

    Thank you!

    You should do a tap wait a second and 1 click at the same place and hold the second tap.

    https://www.dropbox.com/s/23whtlt2gizxu27/MOV_1048.MP4?DL=0

  • How to search and filter my messages?

    Hi all

    I have a problem in my previous threads posted for quick reference Locator.

    The Inbox I got is so heavy that I can't find my post directly because I had a lot of private messages and notifications, etc.

    How do I filter my Inbox to show threads purely valid only?

    Capture.PNG

    The filter option doesn't have the choice of my sons valid only

    Help, please...

    Thank you very much

    MK

    Go to the profile--> content.

  • How to sort and distribution in cluster-table new dashboards?

    Hello

    I have three paintings of an integer (), B (timestamp) and C (double).

    Now, I want to convert them into a table of cluster. The Bay of cluster size is the number of different values in array A (here: two different values 1 and 2)

    If index 0 of the cluster array contains arrays of integers 1 and two with all values of the other two tables where the index of array A is 1.

    Index 1 of the cluster array contains arrays of integers 2 and two with all the values of the other two tables corresponding to the index of array A 2.

    How is that possible?

    Thank you and best regards

    Here is a simple solution that uses table OpenG tools.

  • InDesign Grep: How to add a tab before and after a certain number

    What would be the expression grep to find and replace the following text:

    A paragraph begins with a number (may be more than one) followed by a space and a text. I want to replace it with a tab character before the number (meaning: beginning of paragraph) and another tab after the (or numbers). Thank you very much in advance

    OK, try ^ (\d[^\s]*)(\s+)

  • How to create the filter by date of request for access using database connectivity tool

    Hello

    I had started my project by reading the access data, using a UDL connection,

    but now I want to create a filter for access by using a query that would select two dates and get all the corresponding data, how to query using SQL Parmetrized?

    Best regards

    Note: I do not know the SQL language

    Hi salim_mjs,

    You must use the date format that I have used. It is independent of the format in your database. It should be "month/day/year".

    Mike

  • How to sort datagrid control dataprovider by number

    Some how my database got out of use (when we look at visually through phpmyadmin). Sometimes, the lines are displayed in the phpmyadmin 3,1,2 instead of 1,2,3. Therefore when I retrieve the lines of the php database then the flex datagrid, lines are displayed 3,1,2 as the database. I think that I can reset the database and it fixed; However I would like to have a surefire way to make sure the DataGrid still displays lines numerically in the order of the image_no of each row retrieved from the database.

    I found this for lessons, but cannot not implemented.

    http://www.flexafterdark.com/docs/Flex-CollectionSorting

    The code below has no effect on the order of display in the grid. Can someone help me to do this work. Thank you.

    Import spark.collections.Sort;

    Import spark.collections.SortField;

    private void getImagesResult(event:ResultEvent):void {}
    images = event.result.image as ArrayCollection collection;

    var sortField2:SortField = new SortField ("image_no");
    sortField2.numeric = true;
    sortField2.descending = true;
    images.sort = new Sort();
    images.sort.Fields = [Trichamp2];
    images. Refresh();
    }

    < mx:DataGrid dataProvider = "{images.source}" >
    < mx:columns >
    < mx:DataGridColumn dataField = "image_no" / >
    < mx:DataGridColumn dataField = "image" / >
    < / mx:columns >
    < / mx:DataGridColumn >

    Probably because you assign the images.source and not just images

  • How to save and pass the variable to the BindingInfo resources xWebSite DSC setting.

    Let's say I want to share data and configuration and I would love to sites linking information in the DSCConfigurationdata file, separately from DSC configuration like this:

    xWebsite xWebsite1
    {
    Name = "site.name.com".
    ApplicationPool = "site.name.com."
    Ensure = 'Present '.
    PhysicalPath = "C:\Inetpub\wwwroot\site.name.com."
    State = "started".
    BindingInfo = $Node.BindingInfo
    }

    and DSCConfigurationdata file will contain something following:

    BindingInfo = @)
    @{
    Protocol = "HTTP".
    Port = 80
    IPAddress = "1.1.1.1".
    Hostname = "site.name.com."
    },
    @{
    Protocol = 'HTTPS '.
    Port = 443
    IPAddress = "1.1.1.1".
    Hostname = "site.name.com."
    CertificateThumbprint = "54634563456345."
    NomMagasinCertificat = "accommodation".
    }
    )

    [But since BindingInfo must be of type [CimInstance []]] and it's resource set instance specific ICD I can instantiate and create an array of items of CimInstance (actually MSFT_xWebBindingInformation class).

    So can anyone please can help me on how to do this.

    Thanks in advance.

    JK

    This issue is outside the scope of this site and must be placed on Technet or MSDN
  • How to mount and ISO image a guest VM cd Drive using the command line?

    I have been googled around and couldn't find no clear solution.  Then this possibly done with vSphere PowerCLI or CLI?

    PowerCLI, this can be done with a host device:

    Get - VM | Get-CDDrive. Game-CDDrive - HostDevice "/ dev/scd0 '-connected: $false - confirm: $false

    Yes, do you it with the cmdlet Set-Cddrive. Like this for example

    Get-VM-name | Get-CDDrive. Game-CDDrive - v - IsoPath - confirm: $false

    Don't forget the vacuum between the data store and the ISO-file-path!

    Folder1\cd. ISO»

    You could also do a post similar to the powercli community, but this should answer to your qeustion I think.  The aboce link tell you how the ISO

    See you soon,.

    Chad King

    VCP-410. Server +.

    Twitter: http://twitter.com/cwjking

    If you find this or any other answer useful please consider awarding points marking the answer correct or useful

  • How to create and save the Excel file at the dam using java

    I'm trying to create an excel spreadsheet and save it in the dam. I am able to create Excel in the dam, but no data is it than excel. I use the following codes to create.

    String filename = "updatedMetadata.xls";

    FileOutputStream fos = new FileOutputStream (filename);

    Workbook WritableWorkbook is Workbook.createWorkbook (new File (filename));.

    WritableSheet writableSheet = workbook.createSheet ("update metadata", 0);

    Label = null;

    label = new Label (0, 0, "Header1");

    writableSheet.addCell (label);

    label = new Label (0, 1, "tête2");

    writableSheet.addCell (label);

    label = new Label (0, 2, "Header3");

    writableSheet.addCell (label);

    label = new Label (0, 3, "Header4");

    writableSheet.addCell (label);

    label = new Label (0, 4, "Header5");

    writableSheet.addCell (label);

    label = new Label (0, 5, "Header6");

    writableSheet.addCell (label);

    label = new Label (0, 6, "Header7");

    writableSheet.addCell (label);

    label = new Label (0, 7, "Header8");

    writableSheet.addCell (label);

    label = new Label (1, 0, "col val");

    writableSheet.addCell (label);

    label = new Label (1, 1, "col val");

    writableSheet.addCell (label);

    label = new Label (1, 2, "col val");

    writableSheet.addCell (label);

    label = new Label (1, 3, "col val");

    writableSheet.addCell (label);

    label = new Label (1, 4, "Col. val" "");

    writableSheet.addCell (label);

    label = new Label (1, 5, "col val");

    writableSheet.addCell (label);

    label = new Label (1, 6, "col val");

    writableSheet.addCell (label);

    label = new Label (1, 7, "col val");

    writableSheet.addCell (label);

    label = new Label (2, 0, "col val");

    writableSheet.addCell (label);

    label = new Label (2, 1, "col val");

    writableSheet.addCell (label);

    label = new Label (2, 2, "col val");

    writableSheet.addCell (label);

    label = new Label (2, 3, "col val");

    writableSheet.addCell (label);

    label = new Label (2, 4, ' Col. val "" ");

    writableSheet.addCell (label);

    label = new Label (2, 5, "col val");

    writableSheet.addCell (label);

    label = new Label (2, 6, "col val");

    writableSheet.addCell (label);

    label = new Label (2, 7, "col val");

    writableSheet.addCell (label);

    Workbook.Write ();

    Workbook.Close ();

    ResourceResolver resourceResolver = request.getResourceResolver ();

    AssetManager Manager = resourceResolver.adaptTo (AssetManager.class);

    InputStream is = this.getClass () .getResourceAsStream ("/ content/dam/company/fileFolder /" + filename);

    Element element = manager.createAsset ("/ content/dam/company/fileFolder /" + name of file, is, "application / vnd.ms - excel", true);

    File is created in the path "/ content/dam/company/fileFolder / '.

    The file name is "updatedMetadata.xls".

    Thanks in advance

    Mahesh Narayanan

    I found it myself. I share the code so that in the future someone else can use it.

    String filename = "updatedMetadata.xls";

    ExcelFile to the file = new File (filename);

    Workbook WritableWorkbook = Workbook.createWorkbook (excelFile);

    WritableSheet writableSheet = workbook.createSheet ("update metadata", 0);

    Label = null;

    label = new Label (0, 0, "Header1");

    writableSheet.addCell (label);

    label = new Label (0, 1, "tête2");

    writableSheet.addCell (label);

    label = new Label (0, 2, "Header3");

    writableSheet.addCell (label);

    label = new Label (0, 3, "Header4");

    writableSheet.addCell (label);

    label = new Label (0, 4, "Header5");

    writableSheet.addCell (label);

    label = new Label (0, 5, "Header6");

    writableSheet.addCell (label);

    label = new Label (0, 6, "Header7");

    writableSheet.addCell (label);

    label = new Label (0, 7, "Header8");

    writableSheet.addCell (label);

    label = new Label (1, 0, "col val");

    writableSheet.addCell (label);

    label = new Label (1, 1, "col val");

    writableSheet.addCell (label);

    label = new Label (1, 2, "col val");

    writableSheet.addCell (label);

    label = new Label (1, 3, "col val");

    writableSheet.addCell (label);

    label = new Label (1, 4, "Col. val" "");

    writableSheet.addCell (label);

    label = new Label (1, 5, "col val");

    writableSheet.addCell (label);

    label = new Label (1, 6, "col val");

    writableSheet.addCell (label);

    label = new Label (1, 7, "col val");

    writableSheet.addCell (label);

    label = new Label (2, 0, "col val");

    writableSheet.addCell (label);

    label = new Label (2, 1, "col val");

    writableSheet.addCell (label);

    label = new Label (2, 2, "col val");

    writableSheet.addCell (label);

    label = new Label (2, 3, "col val");

    writableSheet.addCell (label);

    label = new Label (2, 4, ' Col. val "" ");

    writableSheet.addCell (label);

    label = new Label (2, 5, "col val");

    writableSheet.addCell (label);

    label = new Label (2, 6, "col val");

    writableSheet.addCell (label);

    label = new Label (2, 7, "col val");

    writableSheet.addCell (label);

    Workbook.Write ();

    Workbook.Close ();

    ResourceResolver resourceResolver = request.getResourceResolver ();

    AssetManager Manager = resourceResolver.adaptTo (AssetManager.class);

    InputStream stream = new FileInputStream (excelFile);

    Element element = manager.createAsset ("/ content/dam/company/fileFolder /" + name of file, is, "application / vnd.ms - excel", true);

  • How to sort the files transferred to the computer

    * Original title: file transfer

    I have files that have names dates in them viz ' 1986 April 1986 may "etc and I have 3000 on my computer in order of date name but when I copy the file to transfer files on an another compluter resort themselves to Aprils all together can all June etc.  Is there a way I can copy the files, but keep them in the same order?

    Hi Anthony,.

    I will definitely help you with this.

    I suggest you to refer to the advice given by Divya R 19 January 2011 and check if it helps.

    http://answers.Microsoft.com/en-us/Windows/Forum/windows_vista-files/how-to-sorting-and-grouping-files-in-Windows/2f2e08c0-587c-47b1-94a1-1779a91090f7

    If the problem persists or you have any other questions, do not hesitate to let us know. It is our pleasure to be of service.

    Thank you.

  • 42.5 operations in memory of sorting and filtering of lines games

    Hi experts,

    I've had a few queries about this subjects., well I did not understand this topic a little, this will lead to ask me a question. ?

    Description:

    uses jdev11.1.1.5.0 - wls10.3.5, I was ah project say as example HR my application is in race mode employee details screen is rendered fine mode.ok
    I mean something may curious, I enter db - employee - employee table (column name) change in the name of the employee in db 'mark richard' did 'maggie '. but no one is using my name employee app.updated will consider my employee UI app Interface without disturbing screen?

    employee dependent vo - eo.

    ViewObject.QUERY_MODE_SCAN_DATABASE_TABLES

    This is the default mode that retrieves the results of the database.

    so above topic will help me to get an answer to my question... ?

    Thank you & & best regards
    ADF7.

    It's exactly like the quote from the doc. If you use in-memory sort and filter the data in the model layer are used instead of sending a new query to the db.

    Example: you have loaded the employees table in memory (for example select * from employees). Now, you want to see only the employees with a salary< 8000,="" so="" you="" enter="" this="" into="" the="" filter="" of="" the="">
    (a) normal behavior (QUERY_MODE_SCAN_DATABASE_TABLES) means that a query (select * from employees where salary)< 8000)="" is="" send="" to="" the="" db="" and="" you="" get="" the="" result="" set="" back="" showing="" the="" data="" from="" the="" db="" tables="" at="" the="" exact="" point="" when="" you="" send="" the="" query.="" changes="" made="" since="" you="" loaded="" the="" employees="" table="" the="" first="" time="" are="" now="" visible="" in="" the="">
    (b) in memory: now the lines already in the model layer are scanned and filtered and all records with salary< 8000="" are="" put="" into="" the="" result="" set.="" no="" query="" is="" send="" to="" the="" db,="" so="" you="" can't="" see="" changes="" made="" by="" others="" to="" the="" data="" in="" the="">

    Timo

  • How do to copy and paste a table from PDF to Excel using AcrobatX

    How to copy and paste a table of PDF to Excel using AcrobatX?

    I was able to do it easily using acrobat 9 but cannot do it in Acrobat10.

    Has the fgone option, or am I missing something?

    Tomas

    I found that the "selection of export that" both the functions 'copy with formatting' were able to go directly to Excel without using a Word, although it also works. The key in Excel is simply use ctrl + v to paste, do not right click and try to use a special dough or the default value, which went to "keep text only".

  • How to Auto search PDF for some criteria, and then sort and combine PDFs of this criterion.

    I receive 100 faxes a day.  Each fax has a particular bank account # (I have about 40 different bank accounts it could be associated to). I want Adobe Acrobat Pro to search all these faxes to identify the associated bank account #'s.  So I would like to sort these faxes by the identified bank account #.  So I want to combine PDF files into 1 single file PDF for each bank account # (already know how to do this last step). If anyone has any ideas on how to complete the first two functions, it would be greatly appreciated.

    Thank you!

    Hey Ethan,

    I'm sorry, but it is certainly not possible directly via Acrobat.

    Java script code must be created in order to perform the first two tasks.

    Or otherwise you can manually search, sort and combine the PDF "." But it would be a hectic task.

    If you are good with the scripts you could try once and see if you can.

    Concerning

    Sukrit diallo

Maybe you are looking for

  • 23 Firefox blocks Java applets

    Java applet signed my company works well sites online. The applet is also designed to be used from CD and other local file systems. However it now works not at all when running locally, for example, a URL like this: file:///D|/fiscd/search2.htm The a

  • iPhone downloads ios 9.3 5s but does not install it?

    I got 82% battery. I decided to update to 5 s to 9.3. It download the update in about 10 min and off (as usual) to start the installation. But he never started a few leftovers. If I turn it on or do not disturb the process. It's been about 30 minutes

  • Cannot install Windows on MacBook mid 2012 El Capitan 10

    I struggled for a few days to the new installation of Windows 10 on my MacBook Air mid 2012, 13 ". I just upgraded to El Capitan, but my bootcamp still shows the version 5.0.4 (473) when I go to install Windows 10 via USB bootable 64 bit, bootcamp op

  • Red BRAVIA TV flashes 13 times

    If you're Bravia does not light and has a red light that flashes 13 times, see this thread that might help! http://www.agoraquest.com/viewtopic.php... 5 & forum = 34

  • error reported from the transport layer and the error description was impossible to extract

    Hi, can someone please explain how to get rid of the pop-up message when the computer starts up:error reported from the transport layer and the error description could not be found! the message has been lostWindows XP Virgin internet net gear wireles