Re: select query unable to read data

Hi Expert,
for the below code i am getting error for data mismatch i.e FOR OBJEK AND JTAB-MATNR  As i am comparing objek with
matnr it is throwing length mismatch error
SELECT  OBJEK
         ATINN
         FROM AUSP INTO TABLE IT_CHAR2
        move line-matnr to line-objek.
         FOR ALL ENTRIES IN JTAB
         WHERE OBJEK EQ  JTAB-MATNR.
Regards,
Am

Hi
In the declaration of JTAB
data : begin of JTAB occurs 0,
              MATNR type AUSP-OBJEK " Instead of MARA-MATNR or simply MATNR You need to add it
whenever you use FOR ALL ENTRIES the field in left side in the where condition should match length wise with that of the right side one
Ex
select objek
     from AUSP
     into table itab
for all entries in JTAB
where objek = jtab-matnr  " here JTAB-MATNR should have equal length of AUSP-OBJECK
which is 50 char length(if i am not wrong) where as normal MATNR is of 18 char length
Hope this serves the purpose
Cheerz
Ramchander Rao.K

Similar Messages

  • Deleted Rows Flashback : unable to read data - table definition has changed

    Hi All,
    Its Really Important.
    I Unfortunately truncated a table using
    Trancate table mytable;
    and Made a alter table to decrease data pricision length.
    But i Need the tabla data back,
    i used the below command to get deleted rows, it shows error.
    query : select * from pol_tot versions between timestamp systimestamp-1 and systimestamp;
    error : ORA-01466: unable to read data - table definition has changed
    query : flashback table pol_tot to timestamp systimestamp - interval '45' minute;
    error : ORA-01466: unable to read data - table definition has changed
    Kindly Share your ideas How Can i Get thoose Deleted Records.
    Edited by: 887268 on Jul 8, 2012 12:26 AM

    BluShadow wrote:
    Khayyam wrote:
    Flashback dont works after DDL. Truncate command is DDL. Only recover from backup can help.Please don't spread untrue statements.Working of flashback after Drop command is so clear to say. I mean such DDL commands as CREATE, ALTER, TRUNCATE and so on...
    "Remember that DDLs that alter the structure of a table (such as drop/modify column, move table, drop partition, truncate table/partition, and add constraint) invalidate any existing undo data for the table. If you try to retrieve data from a time before such a DDL executed, you will get error ORA-1466. DDL operations that alter the storage attributes of a table (such as PCTFREE, INITRANS, and MAXTRANS) do not invalidate undo data."
    [http://docs.oracle.com/cd/B28359_01/appdev.111/b28424/adfns_flashback.htm#BJFJHDAG]

  • Ora-01466 unable to read data table definition has changed oracle.

    hi all,
    i truncated a table before 10 min. now i want the data's so i used this query ;
    select *
    from ( select *
    from sometable where some_condition )
    as of timestamp sysdate-1;
    but it shows:
    """ ora-01466 unable to read data table definition has changed oracle"""";
    how to get the deleted records from database????????????
    Edited by: 887268 on Oct 24, 2011 4:02 AM

    Error:  ORA 1466
    Text:   unable to read data -- object definition has changed
    Cause:  This is a time-based read consistency error for a database object,
            such as a table or index.
            Either of the following may have happened:
            The query was parsed and executed with a snapshot older than the time
            the object was changed.
            The creation time-stamp of the object is greater than the current
            system time.
            This happens, for example, when the system time is set to a time
            earlier than the creation time of the object.
    Action: If the cause is
            an old snapshot, then commit or rollback the transaction and resume
            work.
            a creation time-stamp in the future, ensure the system time is set
            correctly.
            If the object creation time-stamp is still greater than the system
            time, then export the object's data, drop the object, recreate the
            object so it has a new creation time-stamp, import the object's data,
            and resume work.

  • How to solve this problem "ORA-01466: Unable to read data -- Table definiti

    Hi,
    I had deleted the entry and i want back now and in between i done the following
    alter table pv_head enable constraint FK_PV_HED__CRF_HEDwhen i try in the following one
    SELECT * FROM PV_HEAD AS OF TIMESTAMP TO_DATE('28-FEB-2011 9:45:00','DD-MON-YYYY HH24:MI:SS')
    WHERE PV_NO IN (703705,703704) the error i am receiving           
    ORA-01466: Unable to read data -- Table definition has changed how to solve this issue.
    please guide me.
    Kanish

    You can not perform DDL and then perform a flashback query to before the DDL.
    One might wonder why you chose this particular time to perform an ALTER TABLE but you did. It is what it is.

  • In oracle rac, If user query a select query and in processing data is fetched but in the duration of fetching the particular node is evicted then how failover to another node internally?

    In oracle rac, If user query a select query and in processing data is fetched but in the duration of fetching the particular node is evicted then how failover to another node internally?

    The query is re-issued as a flashback query and the client process can continue to fetch from the cursor. This is described in the Net Services Administrators Guide, the section on Transparent Application Failover.

  • TcpListener not working on Azure: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host

    Hi Everybody,
    i'm playing a little bit with Windows Azure and I'm blocked with a really simple issue (or maybe not).
    I've created a Cloud Service containing one simple Worker Role. I've configured an EndPoint in the WorkerRole configuration, which allows Input connections via tcp on port 10100.
    Here the ServiceDefinition.csdef file content:
    <?xml version="1.0" encoding="utf-8"?>
    <ServiceDefinition name="EmacCloudService" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition" schemaVersion="2014-01.2.3">
    <WorkerRole name="TcpListenerWorkerRole" vmsize="Small">
    <Imports>
    <Import moduleName="Diagnostics" />
    <Import moduleName="RemoteAccess" />
    <Import moduleName="RemoteForwarder" />
    </Imports>
    <Endpoints>
    <InputEndpoint name="Endpoint1" protocol="tcp" port="10100" />
    </Endpoints>
    </WorkerRole>
    </ServiceDefinition>
    This WorkerRole is just creating a TcpListener object listening to the configured port (using the RoleEnvironment instance) and waits for an incoming connection. It receives a message and returns a hardcoded message (see code snippet below).
    namespace TcpListenerWorkerRole
    using System;
    using System.Net;
    using Microsoft.WindowsAzure.ServiceRuntime;
    using System.Net.Sockets;
    using System.Text;
    using Roche.Emac.Infrastructure;
    using System.IO;
    using System.Threading.Tasks;
    using Microsoft.WindowsAzure.Diagnostics;
    using System.Linq;
    public class WorkerRole : RoleEntryPoint
    public override void Run()
    // This is a sample worker implementation. Replace with your logic.
    LoggingProvider.Logger.Info("TcpListenerWorkerRole entry point called");
    TcpListener listener = null;
    try
    listener = new TcpListener(RoleEnvironment.CurrentRoleInstance.InstanceEndpoints["Endpoint1"].IPEndpoint);
    listener.ExclusiveAddressUse = false;
    listener.Start();
    LoggingProvider.Logger.Info(string.Format("TcpListener started at '{0}:{1}'", RoleEnvironment.CurrentRoleInstance.InstanceEndpoints["Endpoint1"].IPEndpoint.Address, RoleEnvironment.CurrentRoleInstance.InstanceEndpoints["Endpoint1"].IPEndpoint.Port));
    catch (SocketException ex)
    LoggingProvider.Logger.Exception("Unexpected exception while creating the TcpListener", ex);
    return;
    while (true)
    Task.Run(async () =>
    TcpClient client = await listener.AcceptTcpClientAsync();
    LoggingProvider.Logger.Info(string.Format("Client connected. Address='{0}'", client.Client.RemoteEndPoint.ToString()));
    NetworkStream networkStream = client.GetStream();
    StreamReader reader = new StreamReader(networkStream);
    StreamWriter writer = new StreamWriter(networkStream);
    writer.AutoFlush = true;
    string input = string.Empty;
    while (true)
    try
    char[] receivedChars = new char[client.ReceiveBufferSize];
    LoggingProvider.Logger.Info("Buffer size: " + client.ReceiveBufferSize);
    int readedChars = reader.Read(receivedChars, 0, client.ReceiveBufferSize);
    char[] validChars = new char[readedChars];
    Array.ConstrainedCopy(receivedChars, 0, validChars, 0, readedChars);
    input = new string(validChars);
    LoggingProvider.Logger.Info("This is what the host sent to you: " + input+". Readed chars=" + readedChars);
    try
    string orderResultFormat = Encoding.ASCII.GetString(Encoding.ASCII.GetBytes("\xB")) + @"MSH|^~\&|Instrument|Laboratory|LIS|LIS Facility|20120427123212+0100||ORL^O34^ORL_O34| 11|P|2.5.1||||||UNICODE UTF-8|||LAB-28^IHE" + Environment.NewLine + "MSA|AA|10" + Environment.NewLine + @"PID|||patientId||""""||19700101|M" + Environment.NewLine + "SPM|1|sampleId&ROCHE||ORH^^HL70487|||||||P^^HL70369" + Environment.NewLine + "SAC|||sampleId" + Environment.NewLine + "ORC|OK|orderId|||SC||||20120427123212" + Encoding.ASCII.GetString(Encoding.ASCII.GetBytes("\x1c\x0d"));
    writer.Write(orderResultFormat);
    catch (Exception e)
    LoggingProvider.Logger.Exception("Unexpected exception while writting the response", e);
    client.Close();
    break;
    catch (Exception ex)
    LoggingProvider.Logger.Exception("Unexpected exception while Reading the request", ex);
    client.Close();
    break;
    }).Wait();
    public override bool OnStart()
    // Set the maximum number of concurrent connections
    ServicePointManager.DefaultConnectionLimit = 12;
    DiagnosticMonitor.Start("Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString");
    RoleEnvironment.Changing += RoleEnvironment_Changing;
    return base.OnStart();
    private void RoleEnvironment_Changing(object sender, RoleEnvironmentChangingEventArgs e)
    // If a configuration setting is changing
    LoggingProvider.Logger.Info("RoleEnvironment is changing....");
    if (e.Changes.Any(change => change is RoleEnvironmentConfigurationSettingChange))
    // Set e.Cancel to true to restart this role instance
    e.Cancel = true;
    As you can see, nothing special is being done. I've used the RoleEnvironment.CurrentRoleInstance.InstanceEndpoints to retrieve the current IPEndpoint.
    Running the Cloud Service in the Windows Azure Compute Emulator everything works fine, but when I deploy it in Azure, then I receive the following Exception:
    2014-08-06 14:55:23,816 [Role Start Thread] INFO EMAC Log - TcpListenerWorkerRole entry point called
    2014-08-06 14:55:24,145 [Role Start Thread] INFO EMAC Log - TcpListener started at '100.74.10.55:10100'
    2014-08-06 15:06:19,375 [9] INFO EMAC Log - Client connected. Address='196.3.50.254:51934'
    2014-08-06 15:06:19,375 [9] INFO EMAC Log - Buffer size: 65536
    2014-08-06 15:06:45,491 [9] FATAL EMAC Log - Unexpected exception while Reading the request
    System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
    at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
    --- End of inner exception stack trace ---
    at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
    at System.IO.StreamReader.ReadBuffer(Char[] userBuffer, Int32 userOffset, Int32 desiredChars, Boolean& readToUserBuffer)
    at System.IO.StreamReader.Read(Char[] buffer, Int32 index, Int32 count)
    at TcpListenerWorkerRole.WorkerRole.<>c__DisplayClass0.<<Run>b__2>d__0.MoveNext() in C:\Work\Own projects\EMAC\AzureCloudEmac\TcpListenerWorkerRole\WorkerRole.cs:line 60
    I've already tried to configure an internal port in the ServiceDefinition.csdef file, but I get the same exception there.
    As you can see, the client can connect to the service (the log shows the message: Client connected with the address) but when it tries to read the bytes from the stream, it throws the exception.
    For me it seems like Azure is preventing the retrieval of the message. I've tried to disable the Firewall in the VM in Azure and the same continues happening.
    I'm using Windows Azure SDK 2.3
    Any help will be very very welcome!
    Thanks in advance!
    Javier
    En caso de que la respuesta te sirva, porfavor, márcala como válida
    Muchas gracias y suerte!
    Javier Jiménez Roda
    Blog: http://jimenezroda.wordpress.com

    hi Javier,
    I changed your code like this:
    private AutoResetEvent connectionWaitHandle = new AutoResetEvent(false);
    public override void Run()
    TcpListener listener = null;
    try
    listener = new TcpListener(
    RoleEnvironment.CurrentRoleInstance.InstanceEndpoints["Endpoint"].IPEndpoint);
    listener.ExclusiveAddressUse = false;
    listener.Start();
    catch (SocketException se)
    return;
    while (true)
    IAsyncResult result = listener.BeginAcceptTcpClient(HandleAsyncConnection, listener);
    connectionWaitHandle.WaitOne();
    The HandleAsync method is your "While (true)" code:
    private void HandleAsyncConnection(IAsyncResult result)
    TcpListener listener = (TcpListener)result.AsyncState;
    TcpClient client = listener.EndAcceptTcpClient(result);
    connectionWaitHandle.Set();
    NetworkStream netStream = client.GetStream();
    StreamReader reader = new StreamReader(netStream);
    StreamWriter writer = new StreamWriter(netStream);
    writer.AutoFlush = true;
    string input = string.Empty;
    try
    char[] receivedChars = new char[client.ReceiveBufferSize];
    // LoggingProvider.Logger.Info("Buffer size: " + client.ReceiveBufferSize);
    int readedChars = reader.Read(receivedChars, 0, client.ReceiveBufferSize);
    char[] validChars = new char[readedChars];
    Array.ConstrainedCopy(receivedChars, 0, validChars, 0, readedChars);
    input = new string(validChars);
    // LoggingProvider.Logger.Info("This is what the host sent to you: " + input + ". Readed chars=" + readedChars);
    try
    string orderResultFormat = Encoding.ASCII.GetString(Encoding.ASCII.GetBytes("\xB")) + @"MSH|^~\&|Instrument|Laboratory|LIS|LIS Facility|20120427123212+0100||ORL^O34^ORL_O34| 11|P|2.5.1||||||UNICODE UTF-8|||LAB-28^IHE" + Environment.NewLine + "MSA|AA|10" + Environment.NewLine + @"PID|||patientId||""""||19700101|M" + Environment.NewLine + "SPM|1|sampleId&ROCHE||ORH^^HL70487|||||||P^^HL70369" + Environment.NewLine + "SAC|||sampleId" + Environment.NewLine + "ORC|OK|orderId|||SC||||20120427123212" + Encoding.ASCII.GetString(Encoding.ASCII.GetBytes("\x1c\x0d"));
    writer.Write(orderResultFormat);
    catch (Exception e)
    // LoggingProvider.Logger.Exception("Unexpected exception while writting the response", e);
    client.Close();
    catch (Exception ex)
    //LoggingProvider.Logger.Exception("Unexpected exception while Reading the request", ex);
    client.Close();
    Please try it. For this error message, I suggest you could refer to this thread (http://stackoverflow.com/questions/6173763/using-windows-azure-to-use-as-a-tcp-server
    ) and this post (http://stackoverflow.com/a/5420788).
    Regards,
    Will
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Unable to read data from the SAP marketplace

    Hi All,
        These days, certain packages in my download basketball cannot be downloaded, while others can be downloaded normally.
         After serveral redirecting, the SAP download manager keeps informing me that "Unable to read data from the SAP marketplace, check your settings and try again".
         Anyone knows how to solve it?
    Thanks,
    Yining

    Hi Yining,
    You user on SAP MarketPlace is locked.
    You have to unlock it but I do not know the way.
    Check in user data maintenance on SAP MarketPlace who is your responsible and perhaps he wwill be able to solve to unlock our user.
    Regards,
    Ronan

  • Unable to read data from the SAP Service Marketplace issue

    Good morning, experts.
    I´ve just installed the SAP Download Manager, but I can´t get connected to Marketplace.
    First I tried downloading a file I could see in my Basket Download. Then I deleted it from the basket so I could test only the connection. In both situations I got the same error message: "Unable to read data from the SAP Service Marketplace (...)".
    It is probably due to wrong settings, but I can´t figure it out. My settings are:
    Address: https://websmp205.sap-ag.de/
    User name: S0005951541
    Password: (my password)
    Proxy (my proxy settings)
    Any ideas?

    Thanks for your answer.
    I can see my download basket online. I realize I didn´t delete the items so I could test purely the connection. I am going to do it again.
    I found out I dind´t have permission to download those items, and with the right permission I could download them directly online.
    As long as I have more information I am going to repost this issue on a new forum.
    Thanks.

  • IMAQ Vision Unable to read data.

    This project is to match multiple templates, then i copied the method from the example "Match Multiple Geometric Pattens", but the error says:
    Error -1074395989 occurred at IMAQ ReadImageAndVisionInfo
    Possible reason(s):
    IMAQ Vision: Unable to read data.
    The problem is that the programming works if I use the labview example's templates. However,when i use the templates which generated by myself, the error appears. I have checked the format and pixels of my generated template, which looks indentical to the example's template.
    Could anybody help me to figure this out? I have attached my docs below.
    Thanks.
    Dylan
    Attachments:
    Multiple-Match-Pattern.zip ‏331 KB

    Hello,
    Labview Geometric matching uses a set of features/descriptors to describe the meaningful information contained in an image. You need to extract these descriptors to permorm the matching.
    Here is an example on how to create the pattern matching templates in Labview (you can alternatively use the Template Editor utility):
    http://forums.ni.com/t5/Machine-Vision/In-Pattern-matching-angle-remains-Zero-even-if-the-rotated/m-...
    (see the attachment in the solution post). You can easily adapt this to learn geometric template (just modify/replace the relevant vi.'s).
    Don't use screen shots to create the templates. Create a template directly from the image.
    Best regards,
    K
    https://decibel.ni.com/content/blogs/kl3m3n
    "Kudos: Users may give one another Kudos on the forums for posts that they found particularly helpful or insightful."

  • Error accessing device data in netweaver."Unable to read data;can't connect

    Hi Friends,
    We have implemented MAM in one of our client here in India. Its around 7 months the project been gone live.
    From last few weeks we are facing problem accessing Device in Netweaver.
    We prepared a patch to be applied to devices but on searching by providing mobile device name ie. eg. MOBILE_000011 it gives an error which says "Unable to read data; cannot connect to middleware".
    It searches the device successfully but but doesnt display its device details,components etc.
    I checked in MI server for short dumps TSV_TNEW_PAGE_ALLOC_FAILED.
    All the measures have been taken to remove this dump. But problem still persist.
    Please suggest to identify the problem.
    Thanks, Amit Sharma

    hello frnds....
    still expecting your views....

  • Unable to read data from Temporary table

    Hello
    Iam calling a stored procedure in java which populates data into a temporary table. This temporary table is reset for each session. The issue is that the procedure is executed successfully but when I run a select query on the temp table, it shows 0 rows.
    When i execute the same procedure from TOAD or MSSQL, the temp table is populated successfully.
    Any Suggestion on what is the possible error
    tnx
    -S-

    Temp table exists for duration of session.
    Make sure you are using the same session.

  • Unable to read data from Analog Devices 6b11 module - error code 1240

    Hi everyone,
    I'm trying to read data from a thermocouple with an AD 6B11 module in an AD 6BP16-1 backplane using RS232 serial. I've been following this guide:
    http://digital.ni.com/public.nsf/allkb/8C77E5E52B4A27968625611600559421
    Everything seems to work out well until step 13, where I call the "AD6B Input Module - Read Data.VI". I get an error code 1240 stating something like "invalid parameter or unable to read instrument".
    Has anyone got any experience with this error or suggestions to fixing it?
    Thanks in advance!

    That user guide is 20+ years old. The serial functions from that day used 0 for com 1, 1 for com 2, etc. Make sure you have the correct one selected. Please provide the exact error message instead of 'something like'.

  • Want to select query based on sample data.

    My Oracle Version
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
    I am creating inventory valuation report using FIFO method . here sample data .
    create table tranx(
    TRXTYPE     varchar2(10) ,ITEM_CODE varchar2(10),     RATE number,qty number
    insert into tranx values('IN'     ,'14042014',     457.2     ,10);
    insert into tranx values('OUT','14042014',     0,          10);
    insert into tranx  values('IN','14042014',     458.1,     35);
    insert into  tranx values('OUT','14042014',     0,          11);
    insert into  tranx values('OUT','14042014',     0,          6);
    insert into  tranx values('IN','     14042014',     457.2     ,10);
    insert into tranx  values('OUT','     14042014',     0,          3);
    insert into tranx  values('OUT','     14042014',     0,          4);
    insert into tranx  values('IN','     14042014',     457.2,     20);
    insert into tranx  values('OUT','     14042014',     0,          5);
    insert into tranx  values('OUT','     14042014',     0,          9);
    insert into tranx  values('OUT','     14042014',     0,          8);
    current output
    TRXTYPE     ITEM_CODE     RATE      QTY
    IN     14042014     457.2     10
    OUT     14042014     0          10
    IN     14042014     458.1     35
    OUT     14042014     0          11
    OUT     14042014     0          6
    IN     14042014     457.2     10
    OUT     14042014     0          3
    OUT     14042014     0          4
    IN     14042014     457.2     20
    OUT     14042014     0          5
    OUT     14042014     0          9
    OUT     14042014     0          8above data populate based on first in first out . but out rate is not comes from that query. suppose fist 10 qty are OUT its rate same as IN. but when qty start out from 35 rate will be 458.1 till all 35 qty will not out. like out qty 11,6,3,4,5,9 now total are 38 .
    when qty 9 will out the rate are 6 qty rate 458.1 and other 3 out rate of 457.2 means total value of 9 out qty value is 4120.20 .
    Now 35 qty is completed and after that rate will continue with 457.2 till 10 qty not completed.
    I think you understand my detail if not please tell me .
    thanks
    i am waiting your reply.

    As SomeoneElse mentioned, there is no row order in relational tables, so you can't tell which row is first and which is next unless ORDER BY is used. So I added column SEQ to your table:
    SQL> select  *
      2    from  tranx
      3  /
    TRXTYPE    ITEM_CODE        RATE        QTY        SEQ
    IN         14042014        457.2         10          1
    OUT        14042014            0         10          2
    IN         14042014        458.1         35          3
    OUT        14042014            0         11          4
    OUT        14042014            0          6          5
    IN         14042014        457.2         10          6
    OUT        14042014            0          3          7
    OUT        14042014            0          4          8
    IN         14042014        457.2         20          9
    OUT        14042014            0          5         10
    OUT        14042014            0          9         11
    TRXTYPE    ITEM_CODE        RATE        QTY        SEQ
    OUT        14042014            0          8         12
    12 rows selected.
    SQL> Now it can be solved. Your task requires either hierarchical or recursive solution. Below is recursive solution using MODEL:
    with t as (
               select  tranx.*,
                       case trxtype
                         when 'IN' then row_number() over(partition by item_code,trxtype order by seq)
                         else 0
                       end rn_in,
                       case trxtype
                         when 'OUT' then row_number() over(partition by item_code,trxtype order by seq)
                         else 0
                       end rn_out,
                       count(case trxtype when 'OUT' then 1 end) over(partition by item_code) cnt_out
                 from  tranx
    select  trxtype,
            item_code,
            rate,
            qty
      from  t
      model
        partition by(item_code)
        dimension by(rn_in,rn_out)
        measures(trxtype,rate,qty,qty qty_remainder,cnt_out,1 current_in,seq)
        rules iterate(10) until(iteration_number + 1 = cnt_out[0,1])
         rate[0,iteration_number + 1]          = rate[current_in[1,0],0],
         qty_remainder[0,iteration_number + 1] = case sign(qty_remainder[0,cv() - 1])
                                                   when 1 then qty_remainder[0,cv() - 1] - qty[0,cv()]
                                                   else qty[current_in[1,0],0] - qty[0,cv()] + nvl(qty_remainder[0,cv() - 1],0)
                                                 end,
         current_in[1,0]                       = case sign(qty_remainder[0,iteration_number + 1])
                                                   when 1 then current_in[1,0]
                                                   else current_in[1,0] + 1
                                                 end
      order by seq
    TRXTYPE    ITEM_CODE        RATE        QTY
    IN         14042014        457.2         10
    OUT        14042014        457.2         10
    IN         14042014        458.1         35
    OUT        14042014        458.1         11
    OUT        14042014        458.1          6
    IN         14042014        457.2         10
    OUT        14042014        458.1          3
    OUT        14042014        458.1          4
    IN         14042014        457.2         20
    OUT        14042014        458.1          5
    OUT        14042014        458.1          9
    TRXTYPE    ITEM_CODE        RATE        QTY
    OUT        14042014        457.2          8
    12 rows selected.
    SQL> SY.

  • Need help in writing a select query to pull required data from 3 tables.

    Hi,
    I have three tables EmpIDs,EmpRoles and LatestRoles. I need to write a select Query to get roles of all employees present in EmpIDs table by referring EmpRoles and LatestRoles.
    The condition is first look into table EmpRoles and if it has more than one entry for a particular Employee ID than only need to get the Role from LatestRoles other wise consider
    the role from EmpRoles .
    Sample Script:
    Create Table #EmpIDs
    (EmplID int )
    Create Table #EmpRoles
    (EMPID int,Designation varchar(50))
    Create Table #LatestRoles
    EmpID int,
    Designation varchar(50)
    Insert into #EmpIDs values (1),(2),(3)
    Insert into #EmpRoles values (1,'Role1'),(2,'Role1'),(2,'Role2'),(3,'Role1')
    Insert into #LatestRoles values (2,'Role2')
    Employee ID 2 is having two roles defined in EmpRoles so for EmpID 2 need to fetch Role from LatestRoles table and for
    remaining ID's need to fetch from EmpRoles .
    My Final Output of select query should be like below.
    EmpID Role
    1 Role1
    2 Role2
    3 Role1
    Please help.
    Mohan

    Mohan,
    Can you check if this answers your requirement:
    Create Table #EmpIDs
    (EmplID int )
    Create Table #EmpRoles
    (EMPID int,Designation varchar(50))
    Create Table #LatestRoles
    EmpID int,
    Designation varchar(50)
    Insert into #EmpIDs values (1)
    Insert into #EmpIDs values (2)
    Insert into #EmpIDs values (3)
    Insert into #EmpRoles values (1,'Role1')
    Insert into #EmpRoles values (2,'Role2')
    Insert into #EmpRoles values (2,'Role1')
    Insert into #EmpRoles values (3,'Role1')
    Insert into #LatestRoles values (2,'Role2')
    --Method 1
    select e.EmplID,MIN(ISNULL(l.Designation,r.Designation)) as Designation
    from #empids e
    left join #emproles r on e.emplID=r.EmpID
    left join #latestRoles l on e.emplID=l.EmpID
    group by e.EmplID
    --Method 2
    ;with cte
    as
    select distinct e.EmplID,r.Designation,count(*) over(partition by e.emplID) cnt
    from #empids e
    left join #emproles r on e.emplID=r.EmpID
    select emplID,Designation
    from cte
    where cnt=1
    UNION ALL
    select a.EmplID,l.Designation
    from
    (select distinct EmplID from cte where cnt>1) a
    join #Latestroles l on a.EmplID=l.EmpID
    order by emplID
    Thanks,
    Jay
    <If the post was helpful mark as 'Helpful' and if the post answered your query, mark as 'Answered'>

  • Regading Select query for Inspection planed date

    Hi,
       I am working on one object.I need to select query to get the inspection plan valid from date(PLKO-DATUV).Logic is Find the group counter(QALS-PLNNR),Group counter(QALS_PLNAL) based on materail(SELMATNR) & BATCH(CHARG) and get the inspection plan valid from date(PLKO-DATUV).How to write the select performance wise.Please help me.
    Regards,
    Sujan

    hi Kat,
    do this way ..
    data : v_date like ekko-aedat value '20080424'.
    select ebeln
    bsart
    aedat
    ernam
    lifnr
    from ekko
    into table it_ekko
    where
    *ebeln eq ekko-ebeln
    and aedat gt v_date
    and bsart 'AN'
    and ( frggr is null or
            frgsx is null or
            frgke eq '1' ) .
    Regards,
    santosh

Maybe you are looking for

  • How to reinstall windows 8 on bootcamp

    how to reinstall windows 8 on bootcamp macbook pro, without losing anything on OS (Apple) side

  • Installing Oracle R12 Express Installation

    Dear All, Is it possible to install Oracle R12 Express Installation on Windows XP SP2 which is on a WorkGroup and not a part of Domain. How to convert the Workgroup into Domain. Please Guide. Regards Hitesh Parsawala

  • Regarding Creating Participants to a Role in one go.

    Hi, Is there any way through which multiple users can be created at the same time for a specific role in BEA Aqualogic BPM Studio/Enterprise server. If there is one, please let me know Regards, Abhishek M

  • Why not "Web Dynpro *with* ABAP"?

    As a newbie I found "Web Dynpro for ABAP" to be confusing.  Any ideas why its worded that way?  Just curious.

  • Create XSL extension

    Is there an easy to understand tutorial with all the step to add a component to the "User Defined Extension Functions" pallet. I want to create a function that call a database stored procedure and be able to use it in an xsl map.