[SQL Question] to_char function not eliminating time from query results

Have a query that returns a time/date field, and I want to eliminate the time, because its not necessary
select distinct c.short_name as client, c.client_id, p.list_id, p.entity_id, e.aid, a.first_name, a.last_name,
p.sf_completed_date, p.email_sent, p.consent_given as dw1_consent, e.share_info_approved as rb_consent
     from profiles p, entities@ROADBED_ASPHALT_READ e,           clients@ROADBED_ASPHALT_READ c,
     lists@ROADBED_ASPHALT_READ l, associates@ROADBED_ASPHALT_READ   a
          where e.share_info_approved = 'Y'
          and sf_completed_date > trunc(to_date('09/11/2006', 'mm/dd/yyyy'))
          and e.list_id in  (715,/*959,*/993,/*995,*/1001,/*1106,*//*1252,*//*1292,*/1321,/*1354,*/1882,/*2061,*/2173,2273,2306,/*2334,*//*2464,*/2693,
2716,2754,2779,2805,2863,/*2864,*//*2939,*/2966,/*3411,*/3412,3602,3679,/*3886,*//*4011,*//*4026,*//*4295,*/4777,4837,5418,7640)
          and p.entity_id = e.entity_id
          and p.list_id = l.list_id
          and l.client_id = c.client_id
          and e.aid = a.aid
          order by c.short_name, a.first_name, a.last_name, sf_completed_date;This query will run by the column of sf_completed_date, it still isn't getting ride of the time, and I have no idea why.
thanks

Use the function substr(p.sf_completed_date, (instr(p.sf_completed_date,'/',1) + 1), length(p.sf_completed_date))
example :
SQL> select instr('1234/5678', '/',1) from dual;
INSTR('1234/5678','/',1)
5
Result gives the position of character '/'.
SQL> select length('1234/5678') from dual;
LENGTH('1234/5678')
9
SQL>
Result gives length of the string - the last character.
Now ----
SQL> select substr('1234/5678',(instr('1234/5678', '/',1) + 1), length('1234/5678')) from dual;
SUBS
5678
SQL>
The result gives you the desired result after / here in your case the date
Hope the example will help you to solve the problem
Surej.
Message was edited by:
Surej

Similar Messages

  • ITunes often does not transfer "time" from CD

    ITunes often does not transfer "time" from the CD -- comes across as "Not available." Other songs on the same CD transfer OK. If there is a "Not available" notation in iTunes, my iPod is unable to play song. Have I "lost" all the previously transferred songs that have "Not available" times? Anyway to recoup them?

    Welcome to Apple Discussions.
    You should post this question in the iTunes forum, where they will be more knowledgable about these issues.

  • Can i play music and use mirroring function at same time from ipad2 to apple tv

    can i play music and use mirroring function at same time from ipad2 to apple tv

    Yes, any audio during the "mirroring" funtion will forward to the appletv. This includes all system audio, games, apps, ect. If you slide the mute botton the side of your ipad to mute then you can block app audio and just get Music audio or Pandora if you are using pandora.

  • HT5312 I Forgot My Answer of Security Questions and iam not receiving email from your side what can i do

    Dear Sir.
    Iam facing a problem that I Forgot My Answer of Security Questions and iam not receiving email from your side what can i do.
    If is possible to Solve this prob as soon as possible.
    Thank You

    We are fellow users here on these user-to-user forums, you're not talking to iTunes Support nor Apple.
    If you aren't receiving the email to your rescue email account (and you've checked the spam folder on the account as well as the inbox, and tried clicking the reset link again) then you will need to contact iTunes Support / Apple in your country to get the questions reset.
    Contacting Apple about account security : http://support.apple.com/kb/HT5699

  • Desktop apps: Report Builder 3.0 (x86) that does not let me allow query result which I created Customers Report. Here is the error message returns.:

    Desktop apps: Report Builder 3.0 (x86) that does not let me allow query result which I created Customers Report. Here is the error message returns as following.
    Database query from: AdventureWorks2014
    System.Web.Services.Protocols.SoapException: The permissions granted to user 'SQLServer2014\Mubs' are insufficient for performing this operation. ---> Microsoft.ReportingServices.Diagnostics.Utilities.AccessDeniedException: The permissions granted to
    user 'mujb-HP\mujb' are insufficient for performing this operation.
       at Microsoft.ReportingServices.Library.ReportingService2010Impl.CreateReportEditSession(String Report, String Parent, Byte[] Definition, String& EditSessionID, Warning[]& Warnings)
       at Microsoft.ReportingServices.WebServer.ReportingService2010.CreateReportEditSession(String Report, String Parent, Byte[] Definition, String& EditSessionID, Warning[]& Warnings)
    The permissions granted to user 'mujb-HP\mujb' are insufficient for performing this operation.
    Is there anybody help me out, pl
    My MSSQL Server express 2014 edition x64  and My desktop "Report Builder (RB) 3.0' is 32bit (x86).
    Does Report Builder x64 exist? I didn't see anywhere so I downloaded x86 RB

    Hi mujb,
    Per my understanding you are using the report builder 3.0 to design the report and when you click the query designer button to execute the query you got the error message above, right?
    I have tested on my local envornment and your issue can be caused by the user "SQLServer2014\Mubs"  and "mujb-HP\mujb"  haven't grant permission to the report server or the shared dataeource/dataset if you have used this.
    I would like to confirm if you have assigned both the Item-Level and System-Level role of the user above to sucessfully access the report server, If you haven't grant any access to the above user and when you connect to the report server in the report builder,
    you may got the error message:
    More details information below for your reference:
    Please execute the query in the microsoft SQL Server Management Studio to see if you have permission to execute the query.
    If the query works fine in step1, please run the report builder as Administrator and if you are using the shared datasource/dataset the issue can be cause by the you haven't grant access the share datasource, Double click to open the Datasource
    and click the "Test Connection" as below to test if it can connect successfully:
    If the "Test Connection" failed, please click the shared datasource/dataset on Report Server to check if you have grant correct permission.
    Related information about the grant permission to report server for your reference:
    https://msdn.microsoft.com/en-us/library/ms156034.aspx
    http://www.allenkinsel.com/archive/2013/01/adventures-in-ssrs/
    If your issue still exists, please try to provide more details information.
    Regards,
    Vicky Liu
    Vicky Liu
    TechNet Community Support

  • Heirarchy is not appearing in my Query result

    Sub: Heirarchy is not appearing in my Query result
    Hi SAP Gurus!
    I am a BW learner..
    My environment is : Training client: SAP BW 3.1 along with SEM 3.2 and BI content 3.1
    What I did :
    1. I have created Info objects     :Mat_No,Mat_name, SRep_Id, SRep_name, Sales_Region, Sales_off, Cust_id, cust_name,
    2. I have created heirarchy for    : SRep_id with Sales_Region,Sales_office
    3. Maintained the master data for  : Sales Region and Sales Office
    4. Up loaded master data for       : Mat_master,Customer_master
    5. While designing the query       : SRep_Id has been dragged into 'Rows'and in the propertice of SRep_id select the name of heirarchy
    What is the problem              : Heirarchy is not appearing in my query result
    What I want is                     : Let ma know where went wrong and what to do for display
                                         of heirarchy in the query result.
    Can you help me in this regard?
    Thnaks in advance
    Vam C

    Thank You venkat and kamal..
    But I did the same and mentioned at point no 5. earlier..
    however I am not getting..
    Can you help me?
    Vam C

  • PLD Report does not show data from Query

    Hello,
    SAP b1 9.0 PL08 on MSSQL 2008 and I get data on the query, but when the PLD prints, it shows nothing. Is there a way to filter the data that the PLD shows? Does PLD have its own SQL script it uses b/c its not showing data from the query.
    Thanks,
    Nick

    Hi Nicholas,
    Please check below links.
    query based print layout design
    Print Layout Designer \Custom Reports
    How to Make a Print Layout (PLD) Report from a SBO Query | SBOnotes.com
    http://www.tegrous.com/wp-content/uploads/2011/07/HowTo_QPrintLs_88.pdf
    Hope this help
    Regards::::
    Atul Chakraborty

  • Create SP that returns value and at the same time displays query result in output window

    I would like create an SP which will return the records from the table and also return value to my c# client application.
    For Example:
    Select * from employee returns all the query results in output window.
    Now I want to create an SP
    Create procedure Test
    As
    Declare @ret int,
    Select * from employee
    set @ret = Select count(*) from employee
    if @ret > 0
    return 1
    else
    return 0
    The above algo should return 1 0r 0 to c# client application and at the same time display all employees in sql query output window.
    Can u pls help in this regard.

    The above algo should return 1 0r 0 to c# client application and at the same time display all employees in sql query output window.
    Why?  and No!
    Why?  Your procedure generates a resultset of some number of rows.  You check the resultset for the presence of rows to determine if "anything is there".  You don't need a separate value to tell you this.  Note that it helps
    to post tsql that is syntactically correct.   While we're at it, if you just need to know that rows exist there is no need to count them since that does more work than required.  Simply test for existence using the appropriately-named function
    "exists".  E.g., if exists (select * from dbo.employee). 
    No!  A stored procedure does not display anything anywhere.  The application which executes the procedures is responsible for the consumption of the resultset; it chooses what to do and what to display. 
    Lastly, do not get into the lazy habit of using the asterisk in your tsql code.  That is not best practice.  Along with that, you should also get into the following best practice habits:
    schema-qualify your objects (i.e., dbo.employee)
    terminate every statement - it will eventually be required.

  • How to manipulate field, char (1) from query results to be a varchar2

    Trying to manipulate the value from SQL Reports data model query (SVALUE1) and use a conditional stmt to change to varchar2 using a variable. i.e,
    if svalue1 = 'Y' then
         tp_srch_type = 'P-P';
    elsif svalue1 = 'N' then
         tp_srch_type = 'P-M';
    elsif svalue1 = 'R' then
         tp_srch_type = 'P-OP';
    return (tp_srch_type);
    I want the report to display the variable tp_srch_type and not svalue1.
    I am limited to using boolean return type when trying to code the trigger in the svalue1 object browser.
    Is it a function or placeholder that can be used within the data model or should this be a PL/SQL outside the data model? If so, how to implement?

    Hi,
    you have at least two different ways to achieve that:
    - you can define a new field in your query using a DECODE function:
    e.g. SELECT svalue1,
    DECODE(svalue1,'Y','P-P','N','P-M','R','P-OP',...) sValue1Dec;
    then you can use sValue1Dec in your layout instead of svalue1;
    - otherwise you can extract only svalue1 from your query and next you can define a 'column formula' field (in the same group as svalue1) defining its PL/SQL formula as:
    function ..............is
    tp_srch_type ....%type;
    begin
    if svalue1 = 'Y' then
    tp_srch_type = 'P-P';
    elsif svalue1 = 'N' then
    tp_srch_type = 'P-M';
    elsif svalue1 = 'R' then
    tp_srch_type = 'P-OP';
    return (tp_srch_type);
    end;
    then you can use your CF field in your layout instead of svalue1;
    Hope this helps you.
    Bye
    Raffy

  • Security Audit Log / Logging of downloads from query results?

    Hi everybody,
    our data protection team has raised the requirement to log all data downloads from our BW system. As far as I know, it is possible to log downloads in SAP GUI using Security Audit Log, but does this also cover "Export to Excel" functionality of query results executed in the portal? And what about execution of queries with BEx Analyzer? I doubt, if that tool would log this. Are there any other tools available to cover that requirement?
    Any comment and idea is welcome. Thanks in advance!
    Regards,
    Carsten

    If restricted to ALV I think it can be done, but even there... if the user executes it in background and mails or prints the spool request then the cat is out of the box...
    Moral of the story: Do not grant access if the user should not be able to see the data (regardless where they log on from).
    That you cannot monitor / log all (mass) download events is however a bit unfortunate, however once the data is outside of the system for those whom you do trust then you anyway need to train them not to park sensitive files on project or public file servers.
    IMO the main problem here is front-end computing tools (like Excel, etc) which the users feel more confortable with to analyze data than the server side analytics tools (e.g. in the ALV task bars, or even the BOBJ Dashboards which are very "user-sentric").
    In German it is known as "Bauern mentalität" (farmer mentality) which generally resides at the application surphase layer in the greater scheme of things:
    -> You do not eat anything you have not slaughtered yourself... 
    Specifically regarding tokenization, you can consider not displaying the data in the portal. If the user wants to display these fields they have to navigate in their own context into the backend system to retrieve the token and then only display individual values.
    --> A download of a list via the portal or BEX excludes these fields which the user can access, but not mass download.
    I think this is possible, but it will be a challenge depending on whether the fields support tockenization. Credit Card numbers as mentioned my Martin is fairly vanilla and already used.
    Custom fields&types, insufficiently critical elements and older programs will be a bigger challenge.
    Please provide more details, as the generic answers are not well take care of IMO. If you cannot provide mre details, then SDN discussions speculating on answers is not efficient either...
    Cheers,
    Julius

  • How to get POF object's field value from query result

    hi,all:
    I want to get field value from the query result, my code is below
    Set setResults = cache.entrySet(createFilter("homeAddress.state = 'MA'"));
    for (Iterator iter = setResults.iterator(); iter.hasNext(); )
    Contact c=(Contact)iter.next();
    System.out.println ("firstame####=" + c.getFirstName());
    * but I get error*
    Exception in thread "main" java.lang.ClassCastException: com.tangosol.util.ConverterCollec
    tions$ConverterEntrySet$ConverterEntry cannot be cast to com.oracle.handson.Contact
    at com.oracle.handson.QueryExample.printResults(QueryExample.java:159)
    at com.oracle.handson.QueryExample.query(QueryExample.java:86)
    at com.oracle.handson.QueryExample.main(QueryExample.java:43)
    who can tell me how to get POF object's field value from query result

    Hi,
    If you look at the Java Doc for the entrySet method here http://download.oracle.com/docs/cd/E15357_01/coh.360/e15725/com/tangosol/util/QueryMap.html#entrySet_com_tangosol_util_Filter_ you will see that it returns a Set of Map.Entry instances so you need to do this...
    Set setResults = cache.entrySet(createFilter("homeAddress.state = 'MA'"));
    for (Iterator iter = setResults.iterator(); iter.hasNext(); )
        Map.Entry entry = iter.next();
        Contact c=(Contact)entry.getValue();
        System.out.println ("firstame####=" + c.getFirstName());
    }JK

  • To_char function not working

    hi,
    I want to get the max dates on format MM/DD/YYYY. the problem is it only works on
    select distinct
    t.id,
    max(to_char (t.tr_date,'MM/DD/YYYY')) as transaction_date,
    s.contract_date,
    max(i.start_date) as start_date,
    max(i.end_date) as end_date
    from trans_history t,
    subscription s,
    inv i
    where t.prod='FTU'
    and t.tr_date >='01-January-2010'
    and s.id=t.id
    and i.id=t.id
    and t.id=1983634
    group by
    t.id,
    s.contract
    result:
    Id Transaction Date Contract Start Date End Date
    1983634 03/10/2010 11/01/2008 17/03/2010 29/03/2010
    then if I change the query like below: im not getting the max values of start date and end date
    select distinct
    t.id,
    max(to_char (t.tr_date,'MM/DD/YYYY')) as transaction_date,
    s.contract_date,
    max(to_char(i.start_date,'MM/DD/YYYY')) as start_date,
    max(to_char(i.end_date,'MM/DD/YYYY')) as end_date
    from trans_history t,
    subscription s,
    inv i
    where t.prod='FTU'
    and t.tr_date >='01-January-2010'
    and s.id=t.id
    and i.id=t.id
    and t.id=1983634
    group by
    t.id,
    s.contract
    I'm wondering why to_char only works on t.tr_date field.
    please help.

    Hi,
    Almost always, TO_CHAR is the last operation you do to DATEs. Do things like MAX before you convert the DATE to a string:
    to_char ( max (t.tr_date)
            , 'MM/DD/YYYY'
            )When comparing the followig strings
    '12/01/2008'
    '07/01/2009'
    '01/30/2010'the greatest is '12/01/2008', because '12' is greater than '07' and '01'.
    You can change the default format for all DATEs in your session like this:
    ALTER SESSION  SET  NLS_DATE_FORMAT = 'MM/DD/YYYY';Then you might not need TO_CHAR at all.
    Edited by: Frank Kulash on Jul 23, 2010 6:51 AM

  • Vendor partner function not getting copied from opportunity to ERP order

    Hi,
    I have created vendors in ERP and replicated them to CRM. The number ranges are different in both the systems. IN CRM it is Y033100476 and in ERP it is 33100476. I have put Y033100476 in the parties involved assignment block and create ERP sales order as follow up. When i do this the broker partner function first of all doesnt appear with partner function Y033100476. And the system gives me warning that "CRM business partner Y033100476 could not be mapped to an ERP customer", i have seen the notes 1236015 and 1446253, but still its not clear to me, that why the vendor partner doesnt gets copied to ERP sales orders, am i missing any setting?

    By standard you:
    1. associate customers to plants in ERP under spro>Materials Management> Purchasing>Purchase Order>Set Up Stock Transport Order. There select button "Plant" to get a list of all plants in the system. Select one plant and press button "Details". In the details screen enter customer number you want to assosiate with plant.
    2. mapp table customer <-> Plant in CRM in table CRMM_LOCMAP. In order to update this table with the information from ERP, run the download object DNL_PLANT. After the download is completed, the table CRMM_LOCMAP should be filled with fresh records which map the 'plant business partners' to respective plants. But as I said in previous post, you can also
    manually update this table with the correct mapping entries.
    Regards.

  • Equipment Partner Function not getting upload from CRM to ECC

    Hi,
    We had download Equipment from ECC to CRM. In CRM we can view this Equipment as Install Base with all partner function which are assigned.
    Now in CRM we had changed the partner function against the instal base but it is not getting replicated to ECC. In SMW01 BDoc is generated and it status is in "Green"
    In case if anyone has encounter this issue then please help us to get this issue fixed.
    With Regards
    Ankush Rai
    Mob: 9423404043

    Hey Ankush,
    Am also getting the same problem.....any luck?
    Regards,
    -Sweta

  • Message appears at time of query results: NO EXCHANGE RATE FROM

    I am executing  query using a new currency translation type  "ZPERAVG". Variable time reference is defined on End of period for 0FISCPER with exchange rate M1 (Monthly Average).  Tested successfully. Purpose is to represent monthly values at differing monthly conversion rates.  When I employ this object in existing queries I am getting informational messages as follow:
    NO EXCHANGE RATE FROM EUR to USD and Date 01/31/2004. This repeats 23 other time for periods to 12/31/2005. My TCURR table does not include these M1 conversions. First period is 01/31/2006. Is there a way around this nuisance message. It will only confuse the user community.
    A second information message also may occur: Error occurred during currency .... however, results appear correct.
    I have no explanation as to why these random messages appear.

    You will have to upate TCURR with monthly average exchange rates for each month starting with January 2004 and going through December 2005, for conversion from Euros to US Dollars. The error being thrown is truly an error because the system is unable to calculate the conversion due to no exchange rate being available for the timeframe.
    Edited by: Dennis Scoville on Sep 18, 2009 4:00 PM

Maybe you are looking for

  • Can't get ringtones to work on my iPhone 4 :(

    I own an iPhone 4 and am trying ot put ringtones on it. I don't have a ringtone tab on my itunes so the online tutorials haven't benn very helpful. can someone link me a walk through on how to make a ringtone from a current song I have in my iTunes l

  • WM material staging for PM work order

    Hi, Please let me know whether I can use the staging area for transfer requirement creating against PM work orders. Thanks in advance. Jash

  • Why to use JMS????

    Hi All, i am new to JMS, can any body tell me Why to use JMS?? i know it used to send message but for why??? if u answer me with an example it will be useful for me. thanks in advance.

  • Fill command no longer works, has turned into Grow

    I've been scouring sites for a solution and have not found one as of yet. My Edit/Fill command (shift + F5) has suddenly turned into Grow. I've seen other people with this problem and the only solution I have seen up to now is to use (shift + delete)

  • Norton Antivirus for Mac causes problems?

    On this, and other advice sites, I'm getting the message Norton for Mac causes performance problems. Is this the general consensus, and can anyone offer more info? I have NAV and my iMac seems slower lately...!