Stored pl/sql procedure retrieving similar records from different tables using

Hi all I'm trying to retrieve the employee num and employee name if they are both a driver and mechanic
I'm script my own procedure and it compiles with no issue but when i try to execute it. they will show me this error.
Error starting at line 29 in command:
EXECUTE VERIFY(1,'John Smith')
Error report:
ORA-01422: exact fetch returns more than requested number of rows
ORA-06512: at "CARSON.VERIFY", line 8
ORA-06512: at line 1
01422. 00000 -  "exact fetch returns more than requested number of rows"
*Cause:    The number specified in exact fetch is less than the rows returned.
*Action:   Rewrite the query or change number of rows requested
This is how my procedure look like:
CREATE OR REPLACE PROCEDURE VERIFY(
enum IN NUMBER,
ename IN VARCHAR) IS
empnum NUMBER;
empname VARCHAR(50);
Fail EXCEPTION;
BEGIN
select employee.e#, employee.name
into empnum, empname
from employee join driver
on driver.e# = employee.e#
join mechanic
on driver.e# = enum;
EXCEPTION
WHEN Fail THEN
dbms_output.put_line('OK');
END VERIFY;
and this is how i execute the procedure
EXECUTE VERIFY(1,'John Smith');
so may i know what have gone wrong? would be glad if someone is able to enlighten me.

No need for a loop.
Just make sure that your query always returns at most one row. Adding a predicate like 'where rownum=1' is a way to achieve that:
select employee.e#
,      employee.name
into   empnum
,      empname
from   employee join driver on driver.e# = employee.e#
                join mechanic on driver.e# = enum
where rownum = 1;

Similar Messages

  • How to read records from Relationship table using ABAP API's

    Hi All,
    I need to retrieve the records from Relationship table. In Java API's I came to know there is an option to retrieve this. I could not find anything in ABAP API's. Is there any option in ABAP API's to do this.
    Please Suggest.
    Thank You,
    Gajendra.

    Hi Gajendra,
    You can mainly read records from MDM (in a DDIC structure) using ABAP API's using the following function modules/methods:
    1. RETRIEVE: This is used to generically retrieve records from tables. Attributes and Values can also be retrieved.
    2. RETRIEVE SIMPLE: Retrieve records from MDM in a simple way.( simple data types).
    3. RETRIEVE CHECKOUT: Retrieves all checked out ID's.
    4. RETRIEVE ATTRIBUTES: Retrieves attribute(s) from a Taxanomy table.
    You will find all these methods in the following interface
    Interface : IF_MDM_CORE_SERVICES
    Hope it helps.
    *Please reward points if found useful.
    Thanks and Regards
    Nitin Jain

  • Callprocedure which contain dynamic sql that retrieve multiple records from VB

    hi dear i have problem with using dynamic sql to retrieve multipule records
    and access them from visual basic
    first i use Oracle8 Enterprise Edition Release 8.0.4.0.0
    and odbc microsoft odbc for oracle version 2.573.4403.00
    these are the whole processes to do that
    please check the steps and if u find any error say to me....
    1-table description
    Name Null? Type
    PORT_KEY NOT NULL VARCHAR2(4)
    CITY_KEY NOT NULL VARCHAR2(4)
    and port_key is primary key
    2- package declaration
    create or replace package ww1
    as
    procedure bound_type
    (v_origin in varchar2,v_flag in varchar2
    ,city_key out dbms_sql.varchar2_table
    end ;
    3- package body
    create or replace package body ww1
    as
    procedure bound_type
    (v_origin in varchar2,v_flag in varchar2
    ,city_key out dbms_sql.varchar2_table
    is
    str varchar2(1000);
    cur_hdl integer :=dbms_sql.open_cursor;
    rows_processed integer;
    indx integer :=1;
    begin
    str:='select ltrim(rtrim(city_key)) from special_airport ';
    if ltrim(rtrim(upper(v_flag))) = upper('c')
    then
    str:=str | | ' where city_key=ltrim(rtrim(upper('| |''''| |v_origin| |''''| |')))';
    elsif ltrim(rtrim(upper(v_flag))) = upper('a') then
    str:= str | |' where port_key=ltrim(rtrim(upper('| |''''| |v_origin| |''''| |')))';
    end if;
    dbms_sql.parse(cur_hdl,str, dbms_sql.native );
    dbms_sql.define_array(cur_hdl,1,city_key,10,indx);
    rows_processed:=dbms_sql.execute(cur_hdl);
    loop
    rows_processed:=dbms_sql.fetch_rows(cur_hdl);
    dbms_sql.column_value(cur_hdl,1,city_key);
    exit when rows_processed != 10;
    end loop;
    dbms_sql.close_cursor(cur_hdl);
    end bound_type;
    end ww1;
    4- code for calling stored procedure from visual basic
    dim c As New ADODB.Connection
    Dim cmd As New ADODB.Command
    Dim rs As New ADODB.Recordset
    c.Open "dsn=dsnName;uid=uidValue;pwd=pwdValue"
    With cmd
    Set .ActiveConnection = c
    .CommandType = adCmdText
    '---------(call bound_type stored procedure)--------------
    .Parameters.Append .CreateParameter(, adBSTR, adParamInput, , "bwi")
    .Parameters.Append .CreateParameter(, adBSTR, adParamInput, , "a")
    .CommandText = "{call fares_procedures.bound_type (?,?,{resultset 10, city_key }) }"
    End With
    Set rs.Source = cmd
    rs.Open
    While Not rs.EOF
    z = rs.Fields("city_key")
    rs.MoveNext
    Wend
    Set cmd = Nothing
    rs.Close
    Set rs = Nothing
    c.Close
    Set c = Nothing
    ***********result get error*************
    please check the code and steps and if u find any error contact me
    thanks any way
    null

    hi every one i got a simple solusion and its faster than dbms_sql package by 1.5 to 3 times...but it works only for oracle 8i or higher......
    after concatenat the string of dynamic sql
    but it in a ref cursor and loop on it
    TYPE VAR_TABLE IS TABLE OF VARCHAR2(40)
    INDEX BY BINARY_INTEGER;
    procedure bound_type
    (v_origin in varchar2,v_flag in varchar2
    ,city_key out var_table )
    is
    str varchar2(1000);
    type curtype is ref cursor;
    sa_cur curtype;
    i integer default 1;
    begin
    str:='select ltrim(rtrim(city_key)) from special_airport ';
    if ltrim(rtrim(upper(v_flag))) = upper('c')
    then
    str:=str | | ' where city_key=ltrim(rtrim(upper('| |''''| |v_origin| |''''| |')))';
    elsif ltrim(rtrim(upper(v_flag))) = upper('a') then
    str:= str | |' where port_key=ltrim(rtrim(upper('| |''''| |v_origin| |''''| |')))';
    end if;
    open sa_cur for str;
    loop
    fetch sa_cur into city_key(i);
    exit when sa_cur%notfound;
    i:=i+1;
    end loop;
    close sa_cur;
    end bound_type;
    null

  • Procedure to check data from different tables

    Hi
    I am trying to write a procedure to compare data from a table with another.
    Table 1
    ID Name Dept
    1 ABC Y
    2 DEF Z
    Table 2
    ID Dept
    1 Y
    2 Z
    Table 3
    Name ID
    1 ABC
    2 DEF
    I would like to compare each record data in Table 1 with data from different tables table2,table3 by matching ID,name.... Please help me with how I could start writing a procedure and also spool data that does not match from the table1 with other tables
    thanks
    Edited by: 890563 on Apr 30, 2012 10:34 AM

    Hope below helps you.
    CREATE TABLE TABLE1
    (    ID          VARCHAR2(10),
         FIRST_NAME  VARCHAR2(30),
         LAST_NAME   VARCHAR2(30),
         MIDDLE_NAME VARCHAR2(30)
    INSERT INTO TABLE1 VALUES('123456','testfirst','testlast','testmiddle');
    INSERT INTO TABLE1 VALUES('123457','testfirst1','testlast1','testmiddle1');
    CREATE TABLE TABLE1
    (    ID          VARCHAR2(10),
         FIRST_NAME  VARCHAR2(30),
         LAST_NAME   VARCHAR2(30),
         MIDDLE_NAME VARCHAR2(30)
    INSERT INTO TABLE2 VALUES('123456','testfirst','testlas','testmidd');
    INSERT INTO TABLE2 VALUES('123457','testfirst2','testlast1','testmiddle1');
    SELECT TABLE1.ID,
            -- Match First Name
         CASE WHEN TABLE1.FIRST_NAME != TABLE2.FIRST_NAME THEN TABLE1.FIRST_NAME ELSE NULL END TABLE1_FIRST_NAME,
         CASE WHEN TABLE1.FIRST_NAME != TABLE2.FIRST_NAME THEN TABLE2.FIRST_NAME ELSE NULL END TABLE2_FIRST_NAME,
            -- Match Middle Name
         CASE WHEN TABLE1.MIDDLE_NAME != TABLE2.MIDDLE_NAME THEN TABLE1.MIDDLE_NAME ELSE NULL END TABLE1_MIDDLE_NAME,
            CASE WHEN TABLE1.MIDDLE_NAME != TABLE2.MIDDLE_NAME THEN TABLE2.MIDDLE_NAME ELSE NULL END TABLE2_MIDDLE_NAME,
            -- Match Last Name
         CASE WHEN TABLE1.LAST_NAME != TABLE2.LAST_NAME THEN TABLE1.LAST_NAME ELSE NULL END TABLE1_LAST_NAME,
            CASE WHEN TABLE1.LAST_NAME != TABLE2.LAST_NAME THEN TABLE2.LAST_NAME ELSE NULL END TABLE2_LAST_NAME
    FROM  TABLE1, TABLE2
    WHERE TABLE1.ID = TABLE2.ID
    ID         TABLE1_FIRST_NAME  TABLE2_FIRST_NAME  TABLE1_MIDDLE_NAME TABLE2_MIDDLE_NAME TABLE1_LAST_NAME   TABLE2_LAST_NAME
    123456     NULL               NULL               testmiddle         testmidd           testlast        testlas
    123457     testfirst1         testfirst2         NULL               NULL               NULL            NULL
    {code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Comparing two records from different tables error.

    Hi folks!
    I have this PL/SQL Block.
    I want to compare the only one record from both tables to see if the content of them are equal or not, but I don't want to specified column by column to do that.
    Any idea?
    Thanks a lot in advanced,
    Abdel E. Miranda S.
    Panama
    declare
    cursor c_aems_prueba is
    select nombre, direccion, telefono, limite, seq
         from aems_prueba;
    cursor c_aems_testing is
    select nombre, direccion, telefono, limite, seq
         from aems_testing;
    vc_aems_prueba c_aems_prueba%rowtype;
    vc_aems_testing c_aems_testing%rowtype;
    vt_aems_prueba aems_prueba%rowtype;
    vt_aems_testing aems_testing%rowtype;
    begin
    insert into aems_prueba
    values('ABDEL MIRANDA', 'PAITILLA', '215-3411', 1000, 1);
    insert into aems_testing
    values('ABDEL MIRANDA', 'PAITILLA', '215-3411', 1000, 1);
    commit;
    open c_aems_prueba;
    fetch c_aems_prueba into vt_aems_prueba;
    open c_aems_prueba;
    fetch c_aems_prueba into vt_aems_testing;
    if vt_aems_prueba = vt_aems_prueba
    then
         dbms_output.put_line('son iguales las variables, si funciona la comparacion de dos estructuras');
         else
         dbms_output.put_line('no son iguales las variables, no funciona la comparacion de dos estructuras');
    end if;
    close c_aems_prueba;
    close c_aems_testing;
    end;

    Satyaki De,
    Java is involving because an Outsourcing new project. The outsourcing company is developing the new application using JSF which invoke an interface java method [depending of the operation: select, update, insert] and them invoke the PLSQL API to precess tha operation.
    In the case I already wrote here, the issue is this:
    The user search for a specific data using the interface. The java method send a request for these operation through the API. the PLSQL process the request and return a beam, with all the column the user look for.
    The user see the information in the application windows. Assuming the user wants to change some data, he modify just one field [lets say telephone number] and press the update button. The application process the request using a different method, which invoke a different function within the PLSQL API.
    Once the information is returning to the API, I must know if at least one field change its value. So I was thinking to get the beam with the data before it was changed and compare it with the beam with the changing data.
    If current_beam = new_beam
    then
    update
    else
    no change to process
    end if;
    Any idea.

  • How to fetch corresponding records from 2 tables using ADF Toplink & EJB

    Hi,
    I am unable to fetch records from 2 tables, which has a foregin key.Used the custom query in toplink, But the output is the cartition of the first table draged and the first row of the second table.The output required should be in the form of ADF Table. I am able to find the output in JSF data table.
    Two tables:
    Table name:Solutions
    sol_id varchar2(PK)
    sol_name varchar2
    Table name:Solution_details
    sol_id varchar2(FK)
    common_asum_id varchar2(PK)
    common_detail varchar2
    Output Required:
    sol_id,sol_name,common_asum_id,common_detail
    Custom query:
    SELECT * FROM solutions a
    ,solution_details b
    WHERE a.sol_id=b.sol_id

    Hi,
    I am unable to fetch records from 2 tables, which has a foregin key.Used the custom query in toplink, But the output is the cartition of the first table draged and the first row of the second table.The output required should be in the form of ADF Table. I am able to find the output in JSF data table.
    Two tables:
    Table name:Solutions
    sol_id varchar2(PK)
    sol_name varchar2
    Table name:Solution_details
    sol_id varchar2(FK)
    common_asum_id varchar2(PK)
    common_detail varchar2
    Output Required:
    sol_id,sol_name,common_asum_id,common_detail
    Custom query:
    SELECT * FROM solutions a
    ,solution_details b
    WHERE a.sol_id=b.sol_id

  • Extracting records from 3 tables using joins in MySQL

    Hi All,
    Pls help me urgently...
    I have a n Order Processing Module and I have 4 tables for this.
    When a new order is placed these 2 tables are populated.
    Order_Customer : records details abt the direct customer/dealer who places the order.
    Order_Product : records the details abt the product (qty, unit price, taxes etc).
    At the Supplier's end the newly placed orders are accepted or rejected and notification is passed on to the despatch dept.
    No when Acceptance authority logs in all the new orders should be viewed..all the previously accepted orders should not be displayed. Here OrderId, OrderDate, Cust/Deal Name (from Order_Customer) and Product, Qty, OrdValue (from Order_Product) are to be displayed. My normal join qry does not work here
    "SELECT * FROM Order_Customer,Order_Product where Order_Customer.OSerialNo NOT IN (SELECT OrdCustSrNo FROM Order_Acceptance) AND Order_Product.OrdCustSrNo NOT IN (SELECT OrdCustSrNo FROM Order_Acceptance) AND Order_Customer.OSerialNo=Order_Product.OrdCustSrNo"
    This gives an error "Unable to load driver.java.sql.SQLException: Syntax error or access violation: You have an error in your SQL syntax near 'SELECT OrdCustSrNo FROM Order_Acceptance) AND Order_Product.OrdCustSrNo NOT IN (' at line 1 "
    Also tried
    "SELECT Order_Customer.* FROM Order_Customer LEFT JOIN Order_Acceptance ON Order_Customer.OSerialNo = Order_Acceptance.OrdCustSrNo where Order_Acceptance.OrdCustSrNo IS NULL";
    Here it gives error Column Name Product not found.
    Similar is the case when moving an Accepted Order to Despatch Dept.
    Need help urgently.

    "SELECT Order_Customer.* FROM Order_Customer LEFT JOIN Order_Acceptance ON Order_Customer.OSerialNo = Order_Acceptance.OrdCustSrNo where Order_Acceptance.OrdCustSrNo IS NULL";
    I think the above query has syntax error. for try with this
    "SELECT * FROM Order_Customer LEFT JOIN Order_Acceptance ON Order_Customer.OSerialNo = Order_Acceptance.OrdCustSrNo and Order_Acceptance.OrdCustSrNo IS NULL";

  • Reading Locked records from HR table using LDB PNP

    Hi,
    I am trying to read the table pa0168 using LDB PNP.
    But the problem is that get pernr staement does not retrieve locked records i.e where PA0168-sprps eq "X'.
    Can anybody help me with this.
    I have to use LDB  so i don't want a solution of writing a select * for the pa0168 table.
    hence i have to use get pernr statement but it should also retrieve locked records.
    how can i achieve that.? please help
    Thanks
    GT
    Message was edited by: GT

    Hi GT,
    In the START-OF-SELECTION event, set the parameter value
    pnp-sw-ignorelockedrecords = 'N'.
    Good Luck,
    Suresh Datti
    ( Pl award points if the answer helps you )

  • Delete records from internal table using another internal table

    HI,
    I have two internal tables itab1 and itab2 which have same records initially.Later some records of itab2 are deleted .Then i want to delete those records from itab1 also ie,those records not found in itab2 .Is there any method other than looping.
    So that itab1 again becomes equal to itab2.
    Thanks in advance.
    Sowmya.

    Soumya,
    Itab1 , Itab2 .
    Before deleting the records from itab2  move those records to one more internal table itab3.
    Now you have deleted records  of itab2  in itab3.
    SORT ITAB3,ITAB1 by your main key field.
    LOOP AT itab3.
      READ TABLE ITAB1 WITH KEY key field = itab3-
      keyfield.
    IF sy-subrc EQ 0.
    DELETE itab1 where keyfield eq itab3-keyfield.
    ENDIF.
    ENDLOOP.

  • Slecting records from MSAccess tables using multiple conditions

    Hi,
    I am trying to build s select list of team names for a
    sporting club website. The select list should include teams if the
    currently logged in user is a coach, team manager, assistant coach,
    player or a parent of a player.
    When I have only one group of conditions in the where clause
    it works fine. But that only accounts for one of the above roles.
    As soon as I ad an OR and another set of criteria my CF7 server's
    swsoc.exe goes into an permanent loop (well, at least 10 minutes, I
    reboot after that :-)
    For example, this works fine ...
    <!--- select teams I coach, assistant coach, manage, am a
    parent of a player, or am a player --->
    <cfquery name="teams"
    Datasource="#Application.Datasource#">
    SELECT distinct teams.uid_team, team_name, uid_coach,
    uid_team_manager, uid_coordinator, team_asst
    from teams, player_agegroups, players
    where
    (player_agegroups.uid_team=teams.uid_team and
    players.uid_user=player_agegroups.uid_user
    and teams.uid_season=#session.season# and
    players.uid_invoice_to=#session.userid#)
    Order by team_name
    </cfquery>
    But as soon as I add another condition cf7 goes into a
    loop...
    <!--- select teams I coach, assistant coach, manage, am a
    parent of a player, or am a player --->
    <cfquery name="teams"
    Datasource="#Application.Datasource#">
    SELECT distinct teams.uid_team, team_name, uid_coach,
    uid_team_manager, uid_coordinator, team_asst
    from teams, player_agegroups, players
    where
    (player_agegroups.uid_team=teams.uid_team and
    players.uid_user=player_agegroups.uid_user
    and teams.uid_season=#session.season# and
    players.uid_invoice_to=#session.userid#) or
    (player_agegroups.uid_team=teams.uid_team and
    players.uid_user=player_agegroups.uid_user
    and teams.uid_season=#session.season# and
    players.uid_user=#session.userid#) or
    (player_agegroups.uid_team=teams.uid_team and
    players.uid_user=player_agegroups.uid_user
    and teams.uid_season=#session.season# and
    teams_uid_coach=#session.userid#) or
    (player_agegroups.uid_team=teams.uid_team and
    players.uid_user=player_agegroups.uid_user
    and teams.uid_season=#session.season# and
    teams.team_asst=#session.userid#) or
    (player_agegroups.uid_team=teams.uid_team and
    players.uid_user=player_agegroups.uid_user
    and teams.uid_season=#session.season# and
    teams.uid_team_manager=#session.userid#)
    Order by team_name
    </cfquery>
    Any combination hangs CF7, whether it be two, three or all
    conditions, and any combination of conditions..
    The teams table stores team name, coach, team manager,
    assistant coach and coordinator. Players table stores the player
    records, and the parent (uid_invoice_to), is part of the player
    record. player agegroups has the teams, with a record for each
    player in a team. The whole system is based around seasons, hence
    the #session.season# variable.
    What should happen is I get a very short list of teams. When
    I select a team from the select list I then go and grab all the
    player records from the player_agegroups table joined to the users
    table to get their names, date of birth etc...
    Can anyone see what I am doing wrong?
    thanks
    Tanya

    Rustywater wrote:
    >
    > For example, this works fine ...
    >
    > <!--- select teams I coach, assistant coach, manage,
    am a parent of a player,
    > or am a player --->
    > <cfquery name="teams"
    Datasource="#Application.Datasource#">
    > SELECT distinct teams.uid_team, team_name, uid_coach,
    uid_team_manager,
    > uid_coordinator, team_asst
    > from teams, player_agegroups, players
    > where
    > (player_agegroups.uid_team=teams.uid_team and
    > players.uid_user=player_agegroups.uid_user
    > and teams.uid_season=#session.season# and
    > players.uid_invoice_to=#session.userid#)
    > Order by team_name
    > </cfquery>
    >
    > But as soon as I add another condition cf7 goes into a
    loop...
    >
    > <!--- select teams I coach, assistant coach, manage,
    am a parent of a player,
    > or am a player --->
    > <cfquery name="teams"
    Datasource="#Application.Datasource#">
    > SELECT distinct teams.uid_team, team_name, uid_coach,
    uid_team_manager,
    > uid_coordinator, team_asst
    > from teams, player_agegroups, players
    > where
    > (player_agegroups.uid_team=teams.uid_team and
    > players.uid_user=player_agegroups.uid_user
    > and teams.uid_season=#session.season# and
    > players.uid_invoice_to=#session.userid#) or
    > (player_agegroups.uid_team=teams.uid_team and
    > players.uid_user=player_agegroups.uid_user
    > and teams.uid_season=#session.season# and
    players.uid_user=#session.userid#) or
    > (player_agegroups.uid_team=teams.uid_team and
    > players.uid_user=player_agegroups.uid_user
    > and teams.uid_season=#session.season# and
    teams_uid_coach=#session.userid#) or
    > (player_agegroups.uid_team=teams.uid_team and
    > players.uid_user=player_agegroups.uid_user
    > and teams.uid_season=#session.season# and
    teams.team_asst=#session.userid#) or
    > (player_agegroups.uid_team=teams.uid_team and
    > players.uid_user=player_agegroups.uid_user
    > and teams.uid_season=#session.season# and
    > teams.uid_team_manager=#session.userid#)
    > Order by team_name
    > </cfquery>
    You are not just OR'ing your data filter, you are also OR'ing
    the
    relations between tables. You should define the relations
    between your
    tables in explicit JOIN statements in your FROM, and filter
    the data in
    your WHERE. You should also remove duplice filters in your
    WHERE
    statement. That would look something like:
    SELECT DISTINCT
    teams.uid_team,
    team_name,
    uid_coach,
    uid_team_manager,
    uid_coordinator,
    team_asst
    FROM
    (teams INNER JOIN
    player_agegroups ON
    player_agegroups.uid_team=teams.uid_team)
    INNER JOIN players ON
    players.uid_user=player_agegroups.uid_user
    WHERE
    teams.uid_season=#session.season#
    AND
    players.uid_invoice_to=#session.userid#
    OR
    players.uid_user=#session.userid#
    OR
    teams_uid_coach=#session.userid#
    OR
    teams.team_asst=#session.userid#
    OR
    teams.uid_team_manager=#session.userid#
    ORDER BY
    team_name
    Jochem
    Jochem van Dieten
    Adobe Community Expert for ColdFusion

  • Problem in identifying unique records from different tables

    Hello gurus,
    I am on E-Recruitment module.
    I order to get more fields in CANDIDATE_ATTR datasource I have enhanced it. I am getting additional fields from HRP5103 (Employer, Employment Start Date & Employment End Date) & from HRP5104 (Institute, City, Region). In both of the tables there are 9 primary keys out of which only two are different through which we can identify duplicate records i.e. OBJID (denote Candidate ID in both tables) & SEQNR(Number of Infotype Record with Same Key).
    I know that compounding InfoObjects (since i need to pull duplicate records from table as one candidate can have many institute & employer but they will always be referred by same OBJID) is one of the way but how to manage data through compounding coming from 2 tables.
    Also i donot want to create new objects as it will effect whole of the setup.
    Is there any other way.
    Can anyone give idea as to how to get records in BW.
    Thanks in advance.

    Hi Sundar,
    Thanks for your help. I wen tthrough the two discussions and found the following:
    1. I cannot include the primary/unique keys in the selection as it would make everything distinct. This restricts me from pointing me to the exact record that has changed.
    2. The columns would be dynamic. I want a config kind of solution where i can define the tables, columns on both the sides. And add/remove compare fields in the setup tables.
    Thanks,
    Faruq.

  • How to Query Multiple Fields from different Tables using Toplink Expression

    Hi,
    I am trying to prepare an Oracle Toplink Expression to qurey the multiple columns of different tables. the query as following. Please can anyone help?
    SELECT CYCLE.CYCLE_ID,
    CYCLE.ASPCUSTOMER_ID,
    CYCLE.FACILITYHEADER_ID,
    CYCLE.ADDUSER,
    ASP.FIRSTNAME || ' ' || ASP.LASTNAME ADDUSERNAME,
    CYCLE.ADDDATE,
    CYCLE.LASTUPDATEUSER,
    ASP.FIRSTNAME || ' ' || ASP.LASTNAME LASTUPDATEUSERNAME,
    CYCLE.LASTUPDATEDATE,
    CYCLE.CYCLENAME,
    CYCLE.CYCLENUMBER,
    CYCLE.DESCRIPTION
    FROM CYCLE,ASPUSER ASP
    WHERE CYCLE.ADDUSER = ASP.ASPUSER_ID
    and then i want to send that expression to readAllObjects method as a parameter
    Expression exp = (..............this is the required qurey expression...................)
    Vector employees = session.readAllObjects(getClass(), exp);
    thanks,

    You havent given any information on the mapping between Cycle and Asp. I presume there is a one to one mapping between them. Also it appears there is no "WHERE" clause to limit the number of cycles being retrieved. If that is the case then I presume you want to load all cycles in the system.
    Thats just a clientSession.readAllObjects(Cycle.class). If you have indirection turned on the Asp should get loaded when you do a cycle.getAsp().
    I presume that SQL you posted loads all the columns of CYCLE and ASP. If you are interested in a subset of CYCLE or ASP then you should do a ReportQuery or partial object read.
    Hi,
    I am trying to prepare an Oracle Toplink Expression
    to qurey the multiple columns of different tables.
    the query as following. Please can anyone help?
    SELECT CYCLE.CYCLE_ID,
    CYCLE.ASPCUSTOMER_ID,
    CYCLE.FACILITYHEADER_ID,
    CYCLE.ADDUSER,
    ASP.FIRSTNAME || ' ' || ASP.LASTNAME ADDUSERNAME,
    CYCLE.ADDDATE,
    CYCLE.LASTUPDATEUSER,
    ASP.FIRSTNAME || ' ' || ASP.LASTNAME
    LASTUPDATEUSERNAME,
    CYCLE.LASTUPDATEDATE,
    CYCLE.CYCLENAME,
    CYCLE.CYCLENUMBER,
    CYCLE.DESCRIPTION
    FROM CYCLE,ASPUSER ASP
    WHERE CYCLE.ADDUSER = ASP.ASPUSER_ID
    and then i want to send that expression to
    readAllObjects method as a parameter
    Expression exp = (..............this is the required
    qurey expression...................)
    Vector employees = session.readAllObjects(getClass(),
    exp);
    thanks,

  • How to Select Data from different Tables Using Linq

    Hi,
    I have two different tables, I just want to collect data from tables using Linq to SQL Queries.
    The tables looks like This 
    ID Name ImageUrl 
    Other Table is
    ID EmpID CheckInTime CheckOutTime 
    What I want to Collect data from CheckInTime and want to place it in a that is in a list view
    Same thing I want to do it for CheckOutTime And One thing I want to tell is both tables are joined by a FK EmpID with ID.
    What Are the suggestions for me 
    I have Used this code
    var data = from emp in db.Employees
    join chk in db.CheckInCheckOuts on emp.ID equals chk.EmpID
    select new EmployeeCheckInOut
    Name = emp.Name,
    ImageUrl = emp.ImageUrl,
    CheckIn = emp.CheckInCheckOuts,
    CheckOut = emp.CheckInCheckOuts
    Here the CheckInCheckOuts is another table, I don't how do I access fields of the Other table "CheckInCheckOuts"
    Thank you
    Ali

    Mitja,
    Kind of Tables, I don't Know but I can Tell you that these are Two table, first Table Have Data in It, Name, ImageUrl I have filled this table with names and ImageUrls And are string type.Other Table is for the CheckInTime And CheckOutTime of the employee.
    What I need that when I click on the Image button it Should displays The Current Datetime into the label below the Image button.
    So I have Problem accessing my CheckInCheckOut Table because I may not have Idea about.Did you understand what I need to do, if you have more question please ask to me.
    Thanks
    Ali

  • How to update multiple columns from different tables using cursor.

    Hi,
    i have two tables test1 and test2. i want to udpate the column(DEPT_DSCR) of both the tables TEST1 and TEST2 using select for update and current of...using cursor.
    I have a code written as follows :
    DECLARE
    v_mydept1 TEST1.DEPT_CD%TYPE;
    v_mydept2 TEST2.DEPT_CD%TYPE;
    CURSOR C1 IS SELECT TEST1.DEPT_CD,TEST2.DEPT_CD FROM TEST1,TEST2 WHERE TEST1.DEPT_CD = TEST2.DEPT_CD AND TEST1.DEPT_CD = 'AA' FOR UPDATE OF TEST1.DEPT_DSCR,TEST2.DEPT_DSCR;
    BEGIN
    OPEN C1;
         LOOP
              FETCH C1 INTO v_mydept1,v_mydept2;
              EXIT WHEN C1%NOTFOUND;
              UPDATE TEST2 SET DEPT_DSCR = 'PLSQL1' WHERE CURRENT OF C1;
              UPDATE TEST2 SET DEPT_DSCR = 'PLSQL2' WHERE CURRENT OF C1;
         END LOOP;
         COMMIT;
    END;
    The above code when run says that it runs successfully. But it does not updates the desired columns[DEPT_DSCR].
    It only works when we want to update single or multiple columns of same table...i.e. by providing these columns after "FOR UPDATE OF"
    I am not sure what is the exact problem when we want to update multiple columns of different tables.
    Can anyone help me on this ?

    oops my mistake.....typo mistake...it should have been as follows --
    UPDATE TEST1 SET DEPT_DSCR = 'PLSQL1' WHERE CURRENT OF C1;
    UPDATE TEST2 SET DEPT_DSCR = 'PLSQL2' WHERE CURRENT OF C1;
    Now here is the upated PL/SQL code where we are trying to update columns of different tables --
    DECLARE
    v_mydept1 TEST1.DEPT_CD%TYPE;
    v_mydept2 TEST2.DEPT_CD%TYPE;
    CURSOR C1 IS SELECT TEST1.DEPT_CD,TEST2.DEPT_CD FROM TEST1,TEST2 WHERE TEST1.DEPT_CD = TEST2.DEPT_CD AND TEST1.DEPT_CD = 'AA' FOR UPDATE OF TEST1.DEPT_DSCR,TEST2.DEPT_DSCR;
    BEGIN
    OPEN C1;
    LOOP
    FETCH C1 INTO v_mydept1,v_mydept2;
    EXIT WHEN C1%NOTFOUND;
    UPDATE TEST1 SET DEPT_DSCR = 'PLSQL1' WHERE CURRENT OF C1;
    UPDATE TEST2 SET DEPT_DSCR = 'PLSQL2' WHERE CURRENT OF C1;
    END LOOP;
    COMMIT;
    END;
    Please let us know why it is not updating by using using CURRENT OF

  • How do I retrieve records from a table using JCO RFC Function Call

    Hi
    I am totally new to SAP Java Progamming. And I would like to know if I am writing code correctly. I read some tutorials in the Internet but I am still not sure if I am doing it the correct way.
    This is what my vendor has given me.
    My question is whether this is the correct optimum way to do get the customer detail based on an array of input values for the customer reference number.
    Input:
    I_CUSTNO - Any number customer IDs. This is a table similar to I_CUSTDETL
    Output:
    Structure name:  I_CUSTDETL
    Note: The CUSTID column has been added in the structure to identify the address of the relevant customer id
    Field details:
    Field Name  Data Type  Length
    CUSTID       Character   10
    COMPANYNAME   Character   40
    EMAIL        Character     40
    This is my code:
            JCoFunction function = connect.getFunction("Z_GET_CUSTOMER");
            JCoTable cust = function.getTableParameterList().getTable("I_CUSTNO");
            cust.appendRow();
            cust.setValue("CUSTID", "10000700");
            cust.appendRow();
            cust.setValue("CUSTID", "10000701");
            cust.appendRow();
            cust.setValue("CUSTID", "10000702");
    connect.execute(function);
            JCoTable table = function.getTableParameterList().getTable("I_CUSTDETL");
              System.out.println("Table size: " + table.getNumRows());
              for (int i = 0; i < table.getNumRows(); i++, table.nextRow()) {
                String custid= table.getValue("CUSTID").toString();
                String companyname = table.getValue("COMPANYNAME").toString();
                String email = table.getValue("EMAIL").toString();
                System.out.println("----
                System.out.println("Record Number::" + i + "::");
                System.out.println("----
                System.out.println("Value custidis::" + custid+ "::");
                System.out.println("Value companyname is::" + companyname + "::");
                System.out.println("Value email is::" + email + "::");

    Hi,
    Answer to your question :whether this is the correct optimum way to do get the customer detail based on an array of input values for the customer reference number? is
    YES.
    Regards,
    Ganga

Maybe you are looking for