SQL Query using DATS data type

Hello people,
I have a table 'TableA' with a column 'xpto' that has DATS data type.
A lot of lines in this table has this field empty.
I have to create a SQL query to select those lines with this field not empty.
Select * from TableA
where xpto is not null
It does not work.... The result is all the lines in the table.
What is wrong?
Thanks!

Easiest way to do this is :
constants l_xpto   type tableA-xpto  value is initial
Select * from TableA
where xpto ne l_xpto.
You can see the NULL/NOT NULL settings for the column through SE11
Utilities -> Database Object -> Display.
I tend to set the "Initial Value" flag when adding columns to tables, which creates the database column as NOT NULL with a default value (whatever SAP considers the initial value for that datatype). I think SAP does this by default, but I've had issues where it hasn't so I do this to ensure consistency
Chris Bain

Similar Messages

  • How to run recordset SQL query in FORM DATA event

    How can I run recordset SQL query in FORM DATA event upon clicking on Add button in the document?

    Hi Slamet,
    When you receive a form data event you have a class containing inside it a ObjectKeys xml info regarding the object added/modified,...
    With the objects keys you can then use the DI API method called GetByKeys to obtain the DI Object.
    There is some information about it in the SDK Help file, mainly in the "FormDataEvent" class definition:
    <i>The event provides the unique ID (BusinessObjectInfo.ObjectKey) of the modified business object. You can use the value of this property as an input parameter in the DI API DataBrowser.GetByKeys method to get a DI object.</i>
    Pay attention you don't have this information in the Before=True event of the Add as it is not yet in the database.
    Hope it helps
    Trinidad.

  • Why does Oracle SQL query returning a date field without the time component

    Hi,
    I'm a novice SQL user & hv just installed Oracle SQL developer (Version 3.0.04, Build MAIN-04.34).
    I made the same SQL query using "Oracle SQL developer" & "TOAD for Oracle 9.0.1" but I got 2 different format on the same date field:
    On TOAD, I get the date field extracted as *04/26/2011 23:12:58*
    On Oracle, I get the date field extracted as *26/APR/11*
    Why is the Oracle result in a different format & missing the time component?
    Is there any option/preference that I need to set in Oracle SQL developer to get the full date/time format displayed?
    I've tried to set my the date format to DD/MON/RR HH12:MI:SSXFF AM under the preference -> database NLS but I still get the same format!
    Plse help!

    hokim wrote:
    Hi,
    I'm a novice SQL user & hv just installed Oracle SQL developer (Version 3.0.04, Build MAIN-04.34).
    I made the same SQL query using "Oracle SQL developer" & "TOAD for Oracle 9.0.1" but I got 2 different format on the same date field:
    On TOAD, I get the date field extracted as *04/26/2011 23:12:58*
    On Oracle, I get the date field extracted as *26/APR/11*
    Why is the Oracle result in a different format & missing the time component?
    Is there any option/preference that I need to set in Oracle SQL developer to get the full date/time format displayed?
    I've tried to set my the date format to DD/MON/RR HH12:MI:SSXFF AM under the preference -> database NLS but I still get the same format!
    Plse help!http://edstevensdba.wordpress.com/category/nls_date_format/

  • Sql query need for date format''Mon 23 Apr 16:45 pm'

    i need SQL query to print date like 'Mon 23 Apr 16:45 pm' format

    SQL> select to_char(sysdate,'Dy fmddfm Mon hh24:mi pm','nls_date_language=american') from dual
      2  /
    TO_CHAR(SYSDATE,'DY
    Fri 27 Apr 13:04 pm
    1 rij is geselecteerd.Regards,
    Rob.

  • How will write SQL query to fetch data from  each Sub-partition..

    Hi All,
    Anyone does have any idea about How to write SQL query to fetch data from Sub-partition.
    Actually i have one table having composite paritition(Range+list)
    Now if i want to fetch data from main partition(Range) the query will be
    SELECT * FROM emp PARTITION(q1_2005);
    Now i want to fetch data at sub-partition level(List) .But i am not able to get any SQL query for that.
    Pls help me to sort out.
    Thanks in Advance.
    Anwar

    SELECT * FROM emp SUBPARTITION(sp1);

  • Is it possible to implemnt af:query using JavaBean Data Control?

    Is it possible to implemnt af:query using JavaBean Data Control?

    Fortunately for you and me, Oracle documents this stuff.
    http://docs.oracle.com/cd/E17904_01/web.1111/b31974/appendix_datacontrols.htm#BABGECDA

  • How to obtain the transformed SQL query using SEM_MATCH

    Dear all,
    Is it possible to get the transformed relational SQL query when using the SEM_MATCH prefix, by querying directly on the database. We are able to obtain the relational SQL query using Joseki/Jena, however this is not the way to go for us. We would like (if possible) to get it straight from the oracle database by logging or something.
    Kind regards.
    Max

    Hi Max,
    Just to clarify. What SEM_MATCH prefix are you talking about?
    A SEM_MATCH based query is indeed a SQL query as SEM_MATCH is a SQL table function. So if you don't want to go through Java APIs or web service endpoint, then running SEM_MATCH directly should give you what you need. Or maybe you just want to see the underlying generated (from SEM_MATCH) SQL query. If that is true, can you please tell us why?
    Thanks,
    Zhe Wu

  • Set TIMEOUT on OCCI sql query using ?

    Is there a way to set a timeout on a sql query using OCCI ?

    OCCI does not provide an API to set timeouts on SQL Queries.
    You can use the CREATE PROFILE command and assign resources at
    a user level. The restrictions may be applied to memory/resources which
    in turn would control the SQL execution time. Please check the
    CREATE PROFILE command.
    Rgds
    Amogh

  • How to find sql query using sqlid

    Hi
    I am not aware of that sqlid .DBA is saying a particular sqlid is making problem .how to find the particular sql query using sql_id ?

    Are you aware of modplsql when i executed the query the result is like
    DECLARE
       rc__             NUMBER;
       simple_list__    OWA_UTIL.vc_arr;
       complex_list__   OWA_UTIL.vc_arr;
    BEGIN
       OWA.init_cgi_env (:n__, :nm__, :v__);
       HTP.htbuf_len := 84;
       NULL;
       NULL;
       simple_list__ (1) := 'sys.%';
       simple_list__ (2) := 'dbms\_%';
       simple_list__ (3) := 'utl\_%';
       simple_list__ (4) := 'owa\_%';
       simple_list__ (5) := 'owa.%';
       simple_list__ (6) := 'htp.%';
       simple_list__ (7) := 'htf.%';
       simple_list__ (8) := 'wpg_docload.%';
       IF ((owa_match.match_pattern ('Oly_browse.oly_pattern ',
                                     simple_list__,
                                     complex_list__,
                                     TRUE
       THEN
          rc__ := 2;
       ELSE
          NULL;
          NULL;
         oly_browse.oly_pattern (search_phrase      => :search_phrase,           --Oly_browse.oly_pattern is package name
                                btn                => :btn,
                                p_qual             => :p_qual,
                                p_bcat             => :p_bcat,
                                p_stdy             => :p_stdy,
                                p_bloc             => :p_bloc,
                                z                  => :z
          IF (WPG_DOCLOAD.is_file_download)
          THEN
             rc__ := 1;
             WPG_DOCLOAD.get_download_file (:doc_info);
             NULL;
             NULL;
             NULL;
             COMMIT;
          ELSE
             rc__ := 0;
             NULL;
             NULL;
             NULL;
             COMMIT;
             OWA.get_page (:data__, :ndata__);
          END IF;
       END IF;
       :rc__ := rc__;
    END; Edited by: vishnu prakash on Sep 8, 2010 10:16 PM

  • UPDATE SQL query using WHERE and a date/time data type... Multiple changes...

    I'm using the LabView Database Connectivity Toolset and am using the following query...
    UPDATE IndexStation
    SET Signal_Size=200
    WHERE 'StartTime=12:05:23'
    Now the problem is that this command seems to update all rows in the table IndexStation... Not just specifically the row where StartTime=12:05:23
    I have tries all sorts of {} [] / ' " around certain characters and column names but it always seems to update all rows...
    I've begun to use the SQL query tab in Access to try and narrow down as to why this happens, but no luck!
    Any ideas!?
    Thanks,
    Chris.

    Chris Walter wrote:
    I completely agree about the Microsoft issue.
    But it seems no SQL based manual states that { } will provide a Date/Time constant.
    Is this an NI only implementation? Because I can't seem to get it to function correctly within LabView or in any SQL query.
    Chris.
    There is nothing about the database toolkit in terms of SQL syntax that would be NI specific. The database Toolkit simply interfaces to MS ADO/DAO and the actual SQL syntax is usually implemented in the database driver or database itself although I wouldn't be surprised if ADO/DAO does at times munch a bit with that too.
    The Database Toolkit definitely does not. So this might be a documentation error indeed. My understanding of SQL syntax is in fact rather limited so not sure which databases might use what delimiters to format date/time values. I know that SQL Server is rather tricky thanks to MS catering for the local date/time format in all their tools and the so called universal date/time format has borked on me on several occasions.
    Rolf Kalbermatter
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Help Required -- Can we use SQL Query to READ data from SAP MDM Tables

    Hi All,
    Please help.........
    Can we use SQL Query to READ(No Creation/Updation/Deletion  just Read) Data from SAP MDM tables directly, without using MDM Syndicator.
    Or direct SQL access to SAP MDM tables is not possible. Only through MDM Syndicator can we export data.
    Thanks in Advance
    Regards

    All the tables you create in Repository comes under A2i_CM_Tables in Database named as your repository name. So the tables names are fields of table A2i_CM_Tables. Now i tried it but cant make it.
    Now, I dont think its possible to extract all fields in tables and there values using select query. May be pure sql guy can do that or not.
    But there is no relation of data extraction and syndicator. Data is viewed in Data Manager. and you can also store data in a file from DM also.
    BR,
    Alok

  • How to write a sql query to retrieve data entered in the past 2 weeks

    Hi,
    I have file names and last accessed date(java.sql.Date format) stored in my database table, I would like to know how I can write a query to get the name of files accessed in the past 2 weeks,I use open sql server at the back end.
    Thanks in advance.

    This has essentially nothing to do with JDBC. JDBC is just an API to execute the SQL language using Java and thus interact with the databases.
    Your problem is related to the SQL language, you don't know how to write the SQL language. I suggest you to go through a SQL tutorial (there is one at w3schools.com) and to read the SQL documentation which come along with the database in question. A decent database manfacturer has a website and probably also a discussion forum / mailinglist as well.
    I'll give you a hint: you can just use equality operators in SQL like everywhere. For example: "WHERE date < somedate".

  • Problem running Portal query using precalculated data

    We are trying to use precalcualated data to run queries in our portal and are running into some issues.
    We have a query with an attached template which uses the cost center group parameter (ksg) to show particular cost centers from a hierarchy created in RSH1.  The query works fine from the BW menu and shows only those cost centers which it should, based on the hierarchy.
    In the Reporting Agent Setting of Administrators workbench (RSA1) we created a reporting agent setting to precalcuate the data and scheduled it to run every couple of hours.
    We have an ivew on our portal which runs the query with the template.  If we add a data_mode parameter and set it to stored, the query seems to use the precalculated data but it seems to ignore the users ksg parameter setting and shows the entire hierarchy of cost centers on the first screen.  If we scroll down to the bottom of the screen and use the down arrow to get the next set of rows, the next screen show the data for only our cost centers based on our ksg parameter setting. 
    However, if we change the data_mode parameter setting to u2018newu2019 the query works as it should and we see the correct cost centers, and not all the ones in the hierarchy so it is going to the OLAP engine for new data and not using the precalculated data.
    We have tried various combination of settings on the Parameter tab of the Change Reporting Agent Setting screen.  We have specified the query name in the Cntrl Query screen.  If we switch from u2018no filteringu2019 to u2018explicity through Query Rsltu2019 the process chain errors out and will not precalc the data.
    Can anyone help?  Thanks.

    Issue SET DEFINE OFF in SQL-Plus before your statement runs.

  • SQL Query Posting the Data Properly but Generating An Error

    I've created a SQL query to update records in a database.  While testing I used an Access database and it worked perfectly.  To go into production I've moved the data to SQLServer 2005 installed on my xMII server.  The SQL syntax is different for handling dates between the two databases so I modified my queries accordingly.  I now have:
    UPDATE ControlLimits SET Metric_ID='[Param.1]', CDate='[Param.2]', LCL=[Param.3], Mean=[Param.4], UCL=[Param.5]
    Where  (Metric_ID='[Param.1]' and CDate = '[Param.2]')
    CDate is my date field being passed in the format 'mm/dd/yyyy', the table field is formatted for datetime - the same as in Access.
    When running this query (with the [Param.x]'s being replaced with actual values)through SQL Server Management Studio on the xMII server, it works just fine.  When run as a query template, the data is posted properly to the table but the template returns a 'A SQL Error has occurred on query, The statement did not return a result set..' 
    Any ideas?
    David

    Udayan,
    You are absolutely correct!  When I did it in Access I was correctly using the Command mode.  When I moved to the SQL Server data source in my query template, I picked the Fixed Query mode by mistake.
    Thanks for your help!
    Regards,
    David

  • Sql query to fetch data based on date conditons

    Hi All,
    We have to schedule a script that runs at 1:00 AM from Monday to Friday.
    The script will run a  sql query  ,that will fetch the data from sql database 2008 based on the below conditions.
    Case 1: If date = current Date then retrieve the data of the previous Date.
    Case 2: If date = Monday then retrieve the entries of Friday ,Saturday and Sunday.
    Please help us on how we can achieve this.
    Thanks

    Hi,
    Are you asking about Patrick's
    solution?
    If so I highly recommend NOT to use this solution. PLease read LMU92's
    and
    Visakh16's responses.
    Why not to use it?
    1. This solution is not deterministic!
    A deterministic algorithm is an algorithm which, given a particular input, will always produce the same output. This solution give different values for different setting! It is depending for example on "SET LANGUAGE" value
    As mentioned above if you try to use any other languge then English then this query will not work since you will never get the value "Sunday"
    2. Moreover! Even if you are using "SET LANGUAGE 'English'" then this
    solution depend on "SET DATEFIRST" and only take into consideration that the value can be 1 or 7, using any other value you will get that @weekendDateMod is null!
    What can you use?
    let's test some value first to get the solution yourself. We know that we don't care about "SET LANGUAGE" since I will not use any language dependency but we need to examine "SET DATEFIRST". Try to change the value from 1 to 7 and check
    the value of this query
    SET DATEFIRST 1 -- Change this value from 1 to 7!
    DECLARE @Sunday DATE = '2014-08-03' -- This is Sunday
    DECLARE @Munday DATE = '2014-08-04' -- This is Munday
    SELECT DATEPART(DW,@Sunday),DATEPART(DW,@Munday), @@DATEFIRST
    Can you see the behavior ?
    The results are hidden here (select the text and you will see them)
    DATEFIRST___Sunday_______Monday
    1___________7___________1
    2___________6___________7
    3___________5___________6
    4___________4___________5
    5___________3___________4
    6___________2___________3
    7___________1___________2
    assuming you did the exercise above yourself, then  you can now think now what is the filter that you need...
    You can use a filter on those two parameters together using "where DATEPART... and @@DATEFIRST...) or using one combine check. Can you think how?
    Notice that this value is always 2 on Monday! Regarding our setting
    (DATEPART(DW,@CurrentDate) + @@DATEFIRST) % 7
    Please Don't Go Down Before YOu Understand!
    Now we can go to the solution
    * I really hope that you read all and did the small exercise yourself! You can not become a developer by copy answers, and this is the reason that from the start I only gave you tha way and not the final query!
    DECLARE @CurrentDate DATE = '2007-08-20' -- This is only for testing since you should use the function GETDATE() instead
    DECLARE @MinDateToFilter DATE
    SET @MinDateToFilter = CASE
    WHEN ((DATEPART(DW,@CurrentDate) + @@DATEFIRST) % 7) = 2 THEN DATEADD(DAY,-4,@CurrentDate)
    ELSE DATEADD(DAY,-1,@CurrentDate)
    END
    SELECT *
    FROM sales.salesOrderHeader
    WHERE orderDate > @MinDateToFilter
    I hope this was useful :-)
    [Personal Site] [Blog] [Facebook]

Maybe you are looking for

  • Cannot create AW using AWM from Schema Sales History in Oracle 10.1.0.3.0

    Hi, I have installed Oracle DB Enterprise Edition and Client 10.1.0.3.0 on Linux. I create the schema SH using the scripts sh_main.sql, csh_v3.sql, lsh_v3.sql, psh_v3.sql and olp_v3.sql from the directory $ORACLE_HOME/demo/schema/sales_history. So fa

  • Olympus E-M10 - still "preliminary support"

    The release notes still say that the Olympus E-M10 has "preliminary support". Is it possible to get some information why it's still preliminary and what we can expect or what's missing? Do the files just get handled as the ones of an E-M5 or E-M1? Is

  • A3 color printer with scanner price

    I want to buy A3 color printer with scanner.so plz send details a list of printer with price.

  • Wireless printing without network?

    Is it possible to print wirelessly without a wireless network? Is it possible to connect a printer to an AirPort Express? There is no broadband network in place. We have 5 people(XP users) that need to use a USB printer. It may be a long shot, but I

  • Isync alcatel onetouch 907D

    I bought the mobile alcatel OneTouch 907D /(dual  SIM) and I would like to use the iSync application to syncronize my MacBoocPro and mya phone. Does it exist a pluging?