Equivalent OBIEE TO_DATE and SUBSTR functions

I have the formula for the next column, which works correctly:

SUM (CASE WHEN (TimeStampDiff (SQL_TSI_month, "Registration - College". "" Effective colleges F. ((("' Program Start Date ', current_date)) / 12 < 6 THEN 1 ELSE 0 END)


I want to replace the current_date with scope of practice. Because the scope of practice is currently not in a date format (e.g. 201213, 201314, 201415), I need to use the TO_DATE and SUBSTR functions OBIEE equivalent to convert this field into a format that can be used by the TimeStampDiff function.

The current (outside OBIEE) SQL for the conversion of the year at a date looks like this:

To_date (substr (Fiscal_Year, 1, 4) |) '09', "YYYYMM")


I tried to replace current_date in the column formula above by the following, but it didn't work:

To this day (Substring ("registration - College". "D time". " "Exercise" FROM 1 to 4) | '09', "YYYYMM")

TO_DATETIME (LEFT ("registration - College". "D time". " ("' Exercise ', 4) | ("/ 09/01 ', ' yyyy/mm/dd')

Good course assuming that "registration - College". "D time". " "' Exercise ' is of type varchar, otherwise you will first need to cast as varchar or LEFT won't like it (but the error will tell you what the problem is exactly).

Tags: Business Intelligence

Similar Questions

  • to_date and to_Char functions does not properly

    TO_CHAR SQL function below, NLS date format game does not: DD-MON-RRRR HH24:MI:SS, which gives an error: ORA-01722: invalid number

    SelectTo_char (January 1, 2014 ","MM-YYYY"") double;

    Wrong forum!

    This question has NOTHING to do with the Sql developer and belongs in the forum Sql and PL/SQL.

    SQL and PL/SQL

    Select To_char (January 1, 2014 ","MM-YYYY"") double;

    Your channel's day, then the month, then the string format and the year has only the month and year and month is a format DIFFERENT from that of the first string.

    Before repost you in the Sql and the forum PL/SQL examine the format of Date/time patterns in the Doc of the SQL language:

    Format patterns

  • TO_CHAR to_date and functions are in error

    Hi guys,.

    My apologies if this look very stupid question to be posted on the forum, but I get errors for the following query:

    select to_date('sysdate','DD-MM-RR HH24:MI:SS') + 6/24 "Adding 6 hours ahead"
    from dual;
    

    It gives me the following error.

    ORA-01858: a non-digit character was found here where was waiting for a digital

    01858 00000 - "a non-digit character found here where was waiting for a digital".

    * Cause: Input data to convert using a date format model has been

    incorrect answer.  The input data did not contain a number where is a number

    required by the format model.

    * Action: Fix the input data or the date format model to ensure that the

    elements correspond to the number and the type.  And then try the operation again.

    What I want, or I'm trying to do is I want knowledge/duty to provide information to add 6 hours before the current system.

    I understand that this is because I am using to_date and "sysdate" but even if I change the to_char I always get an error

    ORA-01722: invalid number

    01722 00000 - "invalid number."

    * Cause:

    * Action:

    Finally, if I try to do something with sudo double table it always gives me error, I tried the following query.

    Query:

    select ('sysdate','DD-MM-RR HH24:MI:SS') + 6/24 "Adding 6 hours ahead"
    from dual;
    

    O/P

    ORA-00907: lack of right parenthesis

    00907 00000 - "lack the right parenthesis.

    * Cause:

    * Action:

    Error on line: column 74: 18

    May I know where I'm basically bad?

    Would be really appreciated your advice.

    Thank you!

    Function SYSDATE returns the DATE data type. So do not point using TO_DATE on it to convert it to DATE.

    What you need is

    SQL > alter session set nls_date_format = 'DD-MON-YYYY HH24:MI:SS ";

    Modified session.

    SQL > select sysdate
    2, sysdate + '6' time-span
    3 double;

    SYSDATE SYSDATE + INTERVAL '6' H
    -------------------- --------------------
    APRIL 21, 2014 03:21:27 APRIL 21, 2014 09:21:27

    SQL >

    Please read Re: 15. I want to store Dates in the Format... Learn about implementing shaped and the DATE data type.

  • Help on using substr and instr functions

    Hello

    I'm trying to go back to the first three letters of the first word and all the last word in a description field. For example, if the description is 'grilled steak' the query should return "steak gri. That's what I have so far:

    SELECT SUPPLIER_ID, PRODUCT_CODE, SUBSTR (DESCRIPTION, 1, 3). ' ' || SUBSTR (DESCRIPTION, INSTR (DESCRIPTION, ' ', 3)) AS A DESCRIPTION
    OF L_FOODS;

    Unfortunately, if the first word is the final word, it returns something like "sod soda." Does anyone have any advice or suggestions? Any help would be appreciated.

    Hi and welcome to the forum!

    It is always helpful if you identify your version of Oracle. The solution below depends on 10.1 and upward.

    What you could do is include a conditional around your instr/substr functions that checks the number of spaces between words. If it is greater or equal two one then there are at least two words. For example:

    WITH test_data AS
    (
         SELECT 'grilled steak' AS DESCRIPTION FROM DUAL UNION ALL
         SELECT 'large pepperoni pizza' AS DESCRIPTION FROM DUAL UNION ALL
         SELECT 'soda' AS DESCRIPTION FROM DUAL
    )
    SELECT     (CASE
              WHEN LENGTH(REGEXP_REPLACE(TRIM(DESCRIPTION),'[^[:space:]]','')) > 0
              THEN SUBSTR(DESCRIPTION,1,3) || SUBSTR(DESCRIPTION,INSTR(DESCRIPTION,' ',-1))
              ELSE SUBSTR(DESCRIPTION,1,3)
         END) AS DESCRIPTION
    FROM     test_data
    

    Results

    SQL> /
    
    DESCRIPTION
    -----------------------
    gri steak
    lar pizza
    sod
    

    : EDITION:

    I also wanted to add this:

    SUBSTR(DESCRIPTION, INSTR(DESCRIPTION, ' ', 3))
    

    May not return the expected results. If your description field contains more than two words he will return all remaining words not only the LAST Word. See my solution above for what I believe is the correct version.

    HTH!

  • SUBSTR and INSTR function

    Hi gurus,

    I have the data as follows:

    data
    -----------------------------------------------------------------------------------------------------------------------
    ' BIDIE01H / TXT:ZUNE = HA011, CellIndex = 144 /CAI:452 - 01-32201-47001 / CAI:45201F7dc9b79a'
    ' BIDIE01H / TXT:ZUNE = HA111, CellIndex = 124 /CAI:452 - 01-32201-471 / CAI:45201F7dc9b79b'


    and I'm writing a SQL results:

    CAI
    ---------
    452 01-32201-47001
    452 01-32201-471

    Any idea to do? I tried around with SUBSTR and INSTR functions but not yet sucessed.

    Thank you
    Alex

    something like:

    with my_tab as (select 'BIDIE01H/TXT:ZUNE=HA011, CellIndex=144 /CAI:452-01-32201-47001/CAI:45201F7dc9b79a' col1 from dual union all
                    select 'BIDIE01H/TXT:ZUNE=HA111, CellIndex=124 /CAI:452-01-32201-471/CAI:45201F7dc9b79b' col1 from dual)
    -- end of mimicking your data: USE SQL below:
    select substr(col1, instr(col1, '/CAI:', 1) + 5, instr(col1, '/CAI:', 1, 2) - instr(col1, '/CAI:', 1) - 5 ) CAI
    from my_tab
    
    CAI
    --------------------------------------------------------------------------------
    452-01-32201-47001
    452-01-32201-471     
    
  • MONTH and YEAR functions.  Help, please...

    Can someone tell me why the YEAR and MONTH functions only accepts the format dd-MMM-yyyy (e.g. 1 January 2009)

    The guest of the calendar will be return only the format dd/mm/yyyy (e.g. 01/01/2009). This makes it pretty useless calendar.

    I really need help on this. Does anyone know how to get the value returned by the calendar in a command prompt in a format that can be used by the YEAR and MONTH functions?

    Thanks in advance

    Here's one without having to resort to assess:

    day: substring (' @{Date1} {01/01/1900}' of (locate('/','@{Date1}{01/01/1900}',1) + 1) for (locate ('/ ',' @{Date1} {01/01/1900}', 4)-locate('/','@{Date1}{01/01/1900}',1)-1))
    month: substring (' @{Date1} {01/01/1900}' of 1 for (locate ('/ ',' @{Date1} {01/01/1900}', 1)-1))
    year: substring (' @{Date1} {01/01/1900}' of (locate ('/ ',' @{Date1} {01/01/1900}', 4) + 1) for 4)

    in the format DD/MM/YYYY

    See also:
    http://obiee101.blogspot.com/2009/03/OBIEE-date-prompt-to-day-month-year.html

    concerning

    John
    http://obiee101.blogspot.com/

    Published by: John Minkjan, March 10, 2009 12:20 AM

  • substr function failure

    Hi, can someone tell me why a simple substr would throw an error if the varchar target assignment is not larger than the length supplied in the substr function three characters?

    can someone tell me why:

    declare
    v_legal varchar2 (200);
    v_disp_trans_sid integer: = 850500;

    Start

    v_legal: = SUBSTR (Ttls_Common.build_parcel_string (v_disp_trans_sid), 1, 200);
    dbms_output.put_line ('v_legal is' |) Length (v_legal) | 'characters.');

    end;
    /

    This causes even if the assignment is substr to 200:

    declare
    *
    ERROR on line 1:
    ORA-06502: PL/SQL: digital or value error: character string buffer too small
    ORA-06512: at line 7

    Yet once I increase the size of the target varchar by three characters it works:

    declare
    v_legal varchar2 (203);
    v_disp_trans_sid integer: = 850500;

    Start

    v_legal: = SUBSTR (Ttls_Common.build_parcel_string (v_disp_trans_sid), 1, 200);
    dbms_output.put_line ('v_legal is' |) Length (v_legal) | 'characters.');

    end;
    /

    causes:

    v_legal is 200 characters.

    PL/SQL procedure successfully completed.

    user521233 wrote:
    my character set:

    Yes, UTF8 is multibyte. Search NLS_LENGTH_SEMANTICS now:

    Select the value from nls_session_parameters where parameter = "NLS_LENGTH_SEMANTICS."

    Most likely it is the BYTE value. If so, as I already mentioned, you can specify explicitly:

    v_legal varchar2 (200 char);

    or you can define the semantics of length for your session of characters instead of bytes

    ALTER SESSION SET NLS_LENGTH_SEMANTICS = CHAR;

    or you can assign this TANK once for the instance:

    ALTER SYSTEM SET NLS_LENGTH_SEMANTICS = CHAR;

    and bounce th instance.

    SY.

  • To specify the SUBSTR function in SqlLdr

    Hello
    I want to clarify the SUBSTR function for that column when I use sqlldr in owb; but I didn't know where I can find this property set. everyone knows?

    Thank you
    Prabha

    Hi Prahba

    .. . If you build the map with the file as the source, add an expression that has the SUBSTR and map this output of the expression attribute to your target, the control generated for the mapping file will have the expression.

    See you soon
    David

  • All drag and drop functionality stopped working in Firefox 16 / Firefox 16.0.2

    Note that when it stopped working exactly but all drag and drop functionality work more... images, URLS, tabs... you name it. I was on 16 FF and upgraded to 16.0.2 without help. SafeMode... same behavior. Disable each add-on single and plugin... same thing again. using the default theme.

    What's left to try?

    I am running Windows XP SP3.

    A complete remission to zero of the system got things working again for me. Not ideal, but I'll take it for now.

  • Thread and ThreadStart functions stop in Labwindows

    Hello

    I'm trying to access a card PCI Express, which uses the ThreadStart functions and ThreadStop driver. When I compile

    my code, LabWindows generate an error "missing" prototype I looked at the source code for the driver and the following line is

    in the header file:

    #if! (defined (WIN32): defined (WIN16)) | defined (WinCE). defined (_MT)
    DWORD DLLCALLCONV ThreadStart(HANDLE *phThread, HANDLER_FUNC pFunc, void *pData);
    Sub DLLCALLCONV ThreadStop (HANDLE hThread);

    #endif

    I use Windows XP Professional, so I guess I wouldn't declare and define functions of theses. If I remove

    the condition, LabWindows may find prototypes, but the same problem occurs for other functions and as I am

    will probably update the driver, I will not comment the code inside the driver.

    If anyone has had the same problem or knows the solution? (maybe an option of the compiler...)

    Thank you

    Cyril

    Oh boy, I think you're screwed! _beginthreadex() belongs to the C from Visual C++ runtime library. his name starts with a '_', which means that it is an extension to the runtime soldier: it is clearly not transferable and will never compile with any other than Visual C++ C runtime library.

    Now you can use Visual C++ to compile your code, or ask the original developer to stop using the TERM private extensions and stick to the standard C and standard system calls. I personally would opt for the second option.

    (in any case, I want to say that CreateThread() is not only for Windows CE: this is a standard Windows API call available on all Windows since Windows 95 systems (maybe even before). don't be fooled by the Windows SDK documentation that separates documentation for Windows CE and Windows standard.) Unfortunately, some rather old SDK documentation shows the first Windows CE functions (especially when you are looking for in the index) people fooling into thinking that these functions are only for THIS: all functions available on Windows CE is also also available for standard WIndows OSes with more options and a more profound documentation.)

  • Lost recovery and Partition function.

    Hello community HP I'm a beginner so this is my first post on a problem im having with my PC, my PC is a HP Pavilion dv4-4075la Entertainment PC.

    Data sheet:

    RAM: 4 GB

    A4 2.1 GHz AMD Dual Core

    OS / Type: Windows 7 Ultimate 64-bit

    AMD Radeon HD 6480G

    Version of DirectXX 11

    Problem: I lost function recovery after a problem with windows so my only option was formatting the entire drive (Partitions included) I lost my recovery Partition and its function, after that I installed Ubuntu 14.04 LTS 64 bit, but it worked not for the games because the graphic card after that I installed Windows 7 Ultimate 64 bit , sound factory OS Windows 7 Home Basic 64 bit, and I want to recovery because HP support Assistant and other HP software don't work properly and im unable to run an uninstall also shutdown my PC due to overheating (90 d) something like that... Sorry for my English im not American.

    So I hope to have an answer or assistance pls also hope to see Linux on the market .

    See you soon!

    Please use the support of HP recovery, you created earlier to return the computer to a factory State. If you create your HP recovery media when you first set up your computer, please contact the official support of HP in your region / country, via the HP portal to support all over the world, to see if the HP recovery support is available for your computer.

    Alternatively, if you can still read the Windows product key of 25 characters on the COA Microsoft attached to your computer, you can install Windows 7 Home Basic by using this key. Please see "how to install Windows 7 without the disc" to get instructions on how to download Windows 7, create the installation media and install Windows 7 using the product key 25 character of the COA Microsoft on your computer. This method will not install HP customizations or value-added software and you will have to manually install all drivers from the page of Entertainment Notebook PC drivers HP Pavilion dv4-4075la.

    Windows 7 SP1 can be found HERE and HERE. (Download the Windows 7 ISO)

    Link to "ei.cfg removal utility" . (Download and use to allow you to install Windows 7 Home Basic Edition)

    Direct link to Windows 7 USB/DVD Download tool. (Use to create ISO support)

    If you have any other questions, feel free to ask.

    Please click the 'Thumbs Up' white LAURELS to show your appreciation

  • Keys - F2 and F3 function does not.

    I bought the laptop HP Pavilion n209TX 15 this year and key functions work properly. But later, on 10 may 2014, they do not work! I checked if there was a software through which he passed, but I did not install any type of software that may adversely affect the operation of the keys. I am really struggling with very low brightness. The last thing I did was - windows update - that installed the following software

    Microsoft Silverlight

    Furthermore, I installed HP Quick fix.

    Whenever I press F2 or F3, it shows just the cursor (it won't go up and down well) and when I click on the slider top, nothing happens again. I also tried to go to the brightness option in the Windows Mobility Center and tried to adjust the brightness - but nothing happens.

    Please help me with this problem.

    Hello and welcome to the Forums of HP.

    I would first make sure that the Intel Grpahics driver is a version that is supported by HP.

    Intel Graphics Driver:

    http://h10025.www1.HP.com/ewfrf/wc/softwareDownloadIndex?softwareitem=ob-129523-1&cc=us&DLC=en&LC=en&OS=4158&product=6622488&sw_lang=

    If the issue still percists then try to reinstall the driver HP wireless button because it helps control the function keys on the laptop.

    HP wireless button Driver:

    http://h10025.www1.HP.com/ewfrf/wc/softwareDownloadIndex?softwareitem=ob-123643-1&cc=us&DLC=en&LC=en&OS=4158&product=6622488&sw_lang=

    Let us know how it works for you.

    Thank you

  • Why in my 5 Nexus not appear cycling and transport functions

    I guess that bike and transport functions are only for Sony Xperia? If so what these functions will appear in the Nexus 5

    I fear bad news.

    Just found the official notification on the updates to the app lifelog. It reads "update for the recognition of activity adding Lifelog app transport & bike with the ability to change the type of activity. Both of these features are exclusive to Sony Xperia devices only. »

    As it says in the above exclusive statement to Sony Xperia devices only. Sorry not on the interfaces between 5.

  • Problem with search and deletion functions

    I use Vista Ultimate and in recent weeks, I have problems using the search and delete functions. Whenever I'm trying to look for something in the search window does not allow me to do and goes in a hand. Whenever I delete something, a small window pops up saying deletion... .and this continues forever.

    Hello

    What antivirus/antispyware/security products do you have on machine? Be one
    you have ALWAYS had on this machine, including those you have uninstalled (they leave leftovers
    can cause strange problems).

    ----------------------------------------------------

    Follow these steps:

    Start - type this in the search box-> find COMMAND at the top and RIGHT CLICK – RUN AS ADMIN

    Enter this at the command prompt - sfc/scannow

    How to analyze the log file entries that the Microsoft Windows Resource Checker (SFC.exe) program
    generates in Windows Vista cbs.log
    http://support.Microsoft.com/kb/928228

    Also run CheckDisk, so we cannot exclude as much as possible of the corruption.
    How to run the check disk at startup in Vista
    http://www.Vistax64.com/tutorials/67612-check-disk-Chkdsk.html

    ==========================================

    After the foregoing:

    How to troubleshoot a problem by performing a clean boot in Windows Vista
    http://support.Microsoft.com/kb/929135
    How to troubleshoot performance issues in Windows Vista
    http://support.Microsoft.com/kb/950685

    Optimize the performance of Microsoft Windows Vista
    http://support.Microsoft.com/kb/959062
    To see everything that is in charge of startup - wait a few minutes with nothing to do - then right-click
    Taskbar - the Task Manager process - take a look at stored by - Services - this is a quick way
    reference (if you have a small box at the bottom left - show for all users, then check that).

    How to check and change Vista startup programs
    http://www.Vistax64.com/tutorials/79612-startup-programs-enable-disable.html

    A quick check to see that load method 2 is - using MSCONFIG then put a list of
    those here.
    --------------------------------------------------------------------

    Tools that should help you:

    Process Explorer - free - find out which files, key of registry and other objects processes have opened.
    What DLLs they have loaded and more. This exceptionally effective utility will show you even who has
    each process.
    http://TechNet.Microsoft.com/en-us/Sysinternals/bb896653.aspx

    Autoruns - free - see what programs are configured to start automatically when you start your system
    and you log in. Autoruns also shows you the full list of registry and file locations where applications can
    Configure auto-start settings.
    http://TechNet.Microsoft.com/en-us/sysinternals/bb963902.aspx
    Process Monitor - Free - monitor the system files, registry, process, thread and DLL real-time activity.
    http://TechNet.Microsoft.com/en-us/Sysinternals/bb896645.aspx

    There are many excellent free tools from Sysinternals
    http://TechNet.Microsoft.com/en-us/Sysinternals/default.aspx

    -Free - WhatsInStartUP this utility displays the list of all applications that are loaded automatically
    When Windows starts. For each request, the following information is displayed: Type of startup (registry/Startup folder), Command - Line String, the product name, Version of the file, the name of the company;
    Location in the registry or the file system and more. It allows you to easily disable or remove unwanted
    a program that runs in your Windows startup.
    http://www.NirSoft.NET/utils/what_run_in_startup.html

    There are many excellent free tools to NirSoft
    http://www.NirSoft.NET/utils/index.html

    Window Watcher - free - do you know what is running on your computer? Maybe not. The window
    Watcher says it all, reporting of any window created by running programs, if the window
    is visible or not.
    http://www.KarenWare.com/PowerTools/ptwinwatch.asp

    Many excellent free tools and an excellent newsletter at Karenware
    http://www.KarenWare.com/

    ===========================================

    Vista and Windows 7 updated drivers love then here's how update the most important.

    This is my generic how updates of appropriate driver:

    This utility, it is easy see which versions are loaded:

    -Free - DriverView utility displays the list of all device drivers currently loaded on your system.
    For each driver in the list, additional useful information is displayed: load address of the driver,
    Description, version, product name, company that created the driver and more.
    http://www.NirSoft.NET/utils/DriverView.html

    For drivers, visit manufacturer of emergency system and of the manufacturer of the device that are the most common.
    Control Panel - device - Graphics Manager - note the brand and complete model
    your video card - double - tab of the driver - write version information. Now, click on update
    Driver (this can do nothing as MS is far behind the certification of drivers) - then right-click.
    Uninstall - REBOOT it will refresh the driver stack.

    Repeat this for network - card (NIC), Wifi network, sound, mouse, and keyboard if 3rd party
    with their own software and drivers and all other main drivers that you have.

    Now in the system manufacturer (Dell, HP, Toshiba as examples) site (in a restaurant), peripheral
    Site of the manufacturer (Realtek, Intel, Nvidia, ATI, for example) and get their latest versions. (Look for
    BIOS, Chipset and software updates on the site of the manufacturer of the system here.)

    Download - SAVE - go to where you put them - right click - RUN AD ADMIN - REBOOT after
    each installation.

    Always check in the Device Manager - drivers tab to be sure the version you actually install
    presents itself. This is because some restore drivers before the most recent is installed (sound card drivers
    in particular that) so to install a driver - reboot - check that it is installed and repeat as
    necessary.

    Repeat to the manufacturers - BTW in the DO NOT RUN THEIR SCANNER device - check
    manually by model.

    Look at the sites of the manufacturer for drivers - and the manufacturer of the device manually.
    http://pcsupport.about.com/od/driverssupport/HT/driverdlmfgr.htm

    How to install a device driver in Vista Device Manager
    http://www.Vistax64.com/tutorials/193584-Device-Manager-install-driver.html

    If you update the drivers manually, then it's a good idea to disable the facilities of driver under Windows
    Updates, that leaves about Windows updates but it will not install the drivers that will be generally
    older and cause problems. If updates offers a new driver and then HIDE it (right click on it), then
    get new manually if you wish.

    How to disable automatic driver Installation in Windows Vista - drivers
    http://www.AddictiveTips.com/Windows-Tips/how-to-disable-automatic-driver-installation-in-Windows-Vista/
    http://TechNet.Microsoft.com/en-us/library/cc730606 (WS.10) .aspx

    Hope these helps.

    Rob - bicycle - Mark Twain said it is good.

  • How can I get the date and time function to appear as a tile

    How can I get the date and time function to appear as a tile

    How can I get the date and time function to appear as a tile

    WIN8 are delivered with this tile/app.  The only way to display the time is to launch the charm bar (Win - key + C) or mouse over to the right up/down.  That said go to the Windows store... There are several free applications that display the time / date as a live tile.  Good luck.

Maybe you are looking for