Syntax check in a join query for detecting max,min cardinalities

Hello my friends
i wrote a query i just want to know if its syntax is correct or not?if possible please rewrite it for me.thank u in advance.
geo_mountain: mountain,country,province
province: name,country,population,area,capital,capprov
mountain: name,height
in fact i want to detect max and min cardinalities between province and mountain.
every mountain is is how many provinces?min and max
every mountain has how many mountain? min and max
select max(select count(*) from province,geo_mountain where provice.name=geo_mountain.provice group by province.name) from province,geo_mountain as MAX_MONTAINS_IN_A_PROVINCE;
select min(select count(*) from province p join geo_mountain geo  on p.name=geo.province group by p.name) from province,geo_mountain as MIN_MONTAINS_IN_A_PROVINCE;
select max(select count(*) from mountain m join geo_mountain geo  on m.name=geo.mountain group by m.name) from province,geo_mountain as MAX_PROVINCES_OF_A_MOUNTAIN;
select min(select count(*) from mountain m join geo_mountain geo  on m.name=geo.mountain group by m.name) from province,geo_mountain as MAX_PROVINCES_OF_A_MOUNTAIN;
--  File created - Thursday-May-02-2013  
--  DDL for Table PROVINCE
  CREATE TABLE "intern"."PROVINCE" ("NAME" VARCHAR2(40), "COUNTRY" CHAR(2), "POPULATION" NUMBER, "AREA" NUMBER, "CAPITAL" VARCHAR2(40), "CAPPROV" VARCHAR2(40))
   COMMENT ON COLUMN "intern"."PROVINCE"."NAME" IS 'the name of the administrative division'
   COMMENT ON COLUMN "intern"."PROVINCE"."COUNTRY" IS 'the country code where it belongs to'
   COMMENT ON COLUMN "intern"."PROVINCE"."POPULATION" IS 'the population of the province'
   COMMENT ON COLUMN "intern"."PROVINCE"."AREA" IS 'the total area of the province'
   COMMENT ON COLUMN "intern"."PROVINCE"."CAPITAL" IS 'the name of the capital'
   COMMENT ON COLUMN "intern"."PROVINCE"."CAPPROV" IS 'the name of the province where the captital belongs to'
   COMMENT ON TABLE "intern"."PROVINCE"  IS 'information about administrative divisions'
REM INSERTING into intern.PROVINCE
SET DEFINE OFF;
Insert into intern.PROVINCE (NAME,COUNTRY,POPULATION,AREA,CAPITAL,CAPPROV) values ('Anhui','cn',73059713,139057,'Hefei','Anhui');
Insert into intern.PROVINCE (NAME,COUNTRY,POPULATION,AREA,CAPITAL,CAPPROV) values ('Aomen','cn',482581,24,'Aomen','Aomen');
Insert into intern.PROVINCE (NAME,COUNTRY,POPULATION,AREA,CAPITAL,CAPPROV) values ('Chongqing','cn',32344010,82403,null,null);
Insert into intern.PROVINCE (NAME,COUNTRY,POPULATION,AREA,CAPITAL,CAPPROV) values ('Fujian','cn',34062204,123603,'Fuzhou','Fujian');
Insert into intern.PROVINCE (NAME,COUNTRY,POPULATION,AREA,CAPITAL,CAPPROV) values ('Gansu','cn',26316859,464186,'Lanzhou','Gansu');
Insert into intern.PROVINCE (NAME,COUNTRY,POPULATION,AREA,CAPITAL,CAPPROV) values ('Guangdong','cn',77333529,177933,'Guangzhou','Guangdong');
Insert into intern.PROVINCE (NAME,COUNTRY,POPULATION,AREA,CAPITAL,CAPPROV) values ('Guangxi','cn',49443331,241410,'Nanning','Guangxi');
Insert into intern.PROVINCE (NAME,COUNTRY,POPULATION,AREA,CAPITAL,CAPPROV) values ('Guizhou','cn',38090358,176505,'Guiyang','Guizhou');
Insert into intern.PROVINCE (NAME,COUNTRY,POPULATION,AREA,CAPITAL,CAPPROV) values ('Hainan','cn',7940197,34353,'Haikou','Hainan');
Insert into intern.PROVINCE (NAME,COUNTRY,POPULATION,AREA,CAPITAL,CAPPROV) values ('Hebei','cn',68949170,187991,'Shijiazhuang','Hebei');
Insert into intern.PROVINCE (NAME,COUNTRY,POPULATION,AREA,CAPITAL,CAPPROV) values ('Heilongjiang','cn',37073415,432477,'Harbin','Heilongjiang');
Insert into intern.PROVINCE (NAME,COUNTRY,POPULATION,AREA,CAPITAL,CAPPROV) values ('Henan','cn',94811791,166499,'Zhengzhou','Henan');
Insert into intern.PROVINCE (NAME,COUNTRY,POPULATION,AREA,CAPITAL,CAPPROV) values ('Hong Kong','cn',6983938,1085,'Victoria','Hong Kong');
Insert into intern.PROVINCE (NAME,COUNTRY,POPULATION,AREA,CAPITAL,CAPPROV) values ('Hubei','cn',61263368,185125,'Wuhan','Hubei');
Insert into intern.PROVINCE (NAME,COUNTRY,POPULATION,AREA,CAPITAL,CAPPROV) values ('Hunan','cn',67787707,211836,'Changsha','Hunan');
Insert into intern.PROVINCE (NAME,COUNTRY,POPULATION,AREA,CAPITAL,CAPPROV) values ('Jiangsu','cn',72117460,97607,'Nanjing','Jiangsu');
Insert into intern.PROVINCE (NAME,COUNTRY,POPULATION,AREA,CAPITAL,CAPPROV) values ('Jiangxi','cn',42590186,167430,'Nanchang','Jiangxi');
Insert into intern.PROVINCE (NAME,COUNTRY,POPULATION,AREA,CAPITAL,CAPPROV) values ('Jilin','cn',27402930,192105,'Changchun','Jilin');
Insert into intern.PROVINCE (NAME,COUNTRY,POPULATION,AREA,CAPITAL,CAPPROV) values ('Liaoning','cn',41699162,147785,'Shenyang','Liaoning');
Insert into intern.PROVINCE (NAME,COUNTRY,POPULATION,AREA,CAPITAL,CAPPROV) values ('Neimenggu','cn',24433946,1218698,'Hohhot','Neimenggu');
Insert into intern.PROVINCE (NAME,COUNTRY,POPULATION,AREA,CAPITAL,CAPPROV) values ('Ningxia','cn',6234044,55461,'Yinchuan','Ningxia');
Insert into intern.PROVINCE (NAME,COUNTRY,POPULATION,AREA,CAPITAL,CAPPROV) values ('Peking','cn',11653700,16808,null,null);
Insert into intern.PROVINCE (NAME,COUNTRY,POPULATION,AREA,CAPITAL,CAPPROV) values ('Qinghai','cn',4928342,716693,'Xining','Qinghai');
Insert into intern.PROVINCE (NAME,COUNTRY,POPULATION,AREA,CAPITAL,CAPPROV) values ('Shaanxi','cn',36881993,205693,'Xian','Shaanxi');
Insert into intern.PROVINCE (NAME,COUNTRY,POPULATION,AREA,CAPITAL,CAPPROV) values ('Shandong','cn',92163194,156867,'Jinan','Shandong');
Insert into intern.PROVINCE (NAME,COUNTRY,POPULATION,AREA,CAPITAL,CAPPROV) values ('Shanghai','cn',13355925,6341,null,null);
Insert into intern.PROVINCE (NAME,COUNTRY,POPULATION,AREA,CAPITAL,CAPPROV) values ('Shanxi','cn',34024073,157023,'Taiyuan','Shanxi');
Insert into intern.PROVINCE (NAME,COUNTRY,POPULATION,AREA,CAPITAL,CAPPROV) values ('Sichuan','cn',86421728,491146,'Chengdu','Sichuan');
Insert into intern.PROVINCE (NAME,COUNTRY,POPULATION,AREA,CAPITAL,CAPPROV) values ('Tianjin','cn',9338819,11632,null,null);
Insert into intern.PROVINCE (NAME,COUNTRY,POPULATION,AREA,CAPITAL,CAPPROV) values ('Tibet','cn',2630000,1228400,'Lhasa','Tibet');
Insert into intern.PROVINCE (NAME,COUNTRY,POPULATION,AREA,CAPITAL,CAPPROV) values ('Xinjiang','cn',19514731,1774034,'Urumqi','Xinjiang');
Insert into intern.PROVINCE (NAME,COUNTRY,POPULATION,AREA,CAPITAL,CAPPROV) values ('Xizang','cn',2610891,1268947,'Lasa','Xizang');
Insert into intern.PROVINCE (NAME,COUNTRY,POPULATION,AREA,CAPITAL,CAPPROV) values ('Yunnan','cn',41997191,393734,'Kunming','Yunnan');
Insert into intern.PROVINCE (NAME,COUNTRY,POPULATION,AREA,CAPITAL,CAPPROV) values ('Zhejiang','cn',46354322,103900,'Hangzhou','Zhejiang');
Insert into intern.PROVINCE (NAME,COUNTRY,POPULATION,AREA,CAPITAL,CAPPROV) values ('Amazonas','co',80360,109665,'Leticia','Amazonas');
Insert into intern.PROVINCE (NAME,COUNTRY,POPULATION,AREA,CAPITAL,CAPPROV) values ('Antioquia','co',5750478,63612,'Medellin','Antioquia');
--  File created - Thursday-May-02-2013  
--  DDL for Table MOUNTAIN
  CREATE TABLE "intern"."MOUNTAIN" ("NAME" VARCHAR2(30), "HEIGHT" NUMBER, "COORDINATES" "intern"."GEOCOORD" )
   COMMENT ON COLUMN "intern"."MOUNTAIN"."NAME" IS 'the name of the mountain'
   COMMENT ON COLUMN "intern"."MOUNTAIN"."HEIGHT" IS 'the height of the mountain'
   COMMENT ON COLUMN "intern"."MOUNTAIN"."COORDINATES" IS 'its geographical coordinates as (longitude, latitude)'
   COMMENT ON TABLE "intern"."MOUNTAIN"  IS 'information about mountains'
REM INSERTING into intern.MOUNTAIN
SET DEFINE OFF;
Insert into intern.MOUNTAIN (NAME,HEIGHT,COORDINATES) values ('Bjelucha',4506);
Insert into intern.MOUNTAIN (NAME,HEIGHT,COORDINATES) values ('Istor-o-Nal',7403);
Insert into intern.MOUNTAIN (NAME,HEIGHT,COORDINATES) values ('Jabal Marra',3088);
Insert into intern.MOUNTAIN (NAME,HEIGHT,COORDINATES) values ('Jezerce',2694);
Insert into intern.MOUNTAIN (NAME,HEIGHT,COORDINATES) values ('Joekul',1876);
Insert into intern.MOUNTAIN (NAME,HEIGHT,COORDINATES) values ('Jongsong Peak',7483);
Insert into intern.MOUNTAIN (NAME,HEIGHT,COORDINATES) values ('Jostedalsbre',2083);
Insert into intern.MOUNTAIN (NAME,HEIGHT,COORDINATES) values ('K12',7428);
Insert into intern.MOUNTAIN (NAME,HEIGHT,COORDINATES) values ('K2',8614);
Insert into intern.MOUNTAIN (NAME,HEIGHT,COORDINATES) values ('Kangchenjunga',8586);
Insert into intern.MOUNTAIN (NAME,HEIGHT,COORDINATES) values ('Khunyang Chhish',7852);
Insert into intern.MOUNTAIN (NAME,HEIGHT,COORDINATES) values ('Kilimanjaro',5895);
Insert into intern.MOUNTAIN (NAME,HEIGHT,COORDINATES) values ('Kinabalu',4101);
Insert into intern.MOUNTAIN (NAME,HEIGHT,COORDINATES) values ('Kings Peak',4123);
Insert into intern.MOUNTAIN (NAME,HEIGHT,COORDINATES) values ('Kongur Tagh',7649);
Insert into intern.MOUNTAIN (NAME,HEIGHT,COORDINATES) values ('Kongur Tjube',7595);
Insert into intern.MOUNTAIN (NAME,HEIGHT,COORDINATES) values ('Korab',2751);
Insert into intern.MOUNTAIN (NAME,HEIGHT,COORDINATES) values ('Kula Kangri',7538);
--  File created - Thursday-May-02-2013  
--  DDL for Table GEO_MOUNTAIN
  CREATE TABLE "INTERN"."GEO_MOUNTAIN" ("MOUNTAIN" VARCHAR2(30), "COUNTRY" CHAR(2), "PROVINCE" VARCHAR2(40))
   COMMENT ON COLUMN "INTERN"."GEO_MOUNTAIN"."MOUNTAIN" IS 'the name of the mountain'
   COMMENT ON COLUMN "INTERN"."GEO_MOUNTAIN"."COUNTRY" IS 'the country code where it is located'
   COMMENT ON COLUMN "INTERN"."GEO_MOUNTAIN"."PROVINCE" IS 'the province of this country'
   COMMENT ON TABLE "INTERN"."GEO_MOUNTAIN"  IS 'geographical information about mountains'
REM INSERTING into INTERN.GEO_MOUNTAIN
SET DEFINE OFF;
Insert into INTERN.GEO_MOUNTAIN (MOUNTAIN,COUNTRY,PROVINCE) values ('Minya Konka','cn','Sichuan');
Insert into INTERN.GEO_MOUNTAIN (MOUNTAIN,COUNTRY,PROVINCE) values ('Broad Peak','cn','Xinjiang');
Insert into INTERN.GEO_MOUNTAIN (MOUNTAIN,COUNTRY,PROVINCE) values ('Gasherbrum I','cn','Xinjiang');
Insert into INTERN.GEO_MOUNTAIN (MOUNTAIN,COUNTRY,PROVINCE) values ('Gasherbrum II','cn','Xinjiang');
Insert into INTERN.GEO_MOUNTAIN (MOUNTAIN,COUNTRY,PROVINCE) values ('K2','cn','Xinjiang');
Insert into INTERN.GEO_MOUNTAIN (MOUNTAIN,COUNTRY,PROVINCE) values ('Kongur Tagh','cn','Xinjiang');
Insert into INTERN.GEO_MOUNTAIN (MOUNTAIN,COUNTRY,PROVINCE) values ('Kongur Tjube','cn','Xinjiang');
Insert into INTERN.GEO_MOUNTAIN (MOUNTAIN,COUNTRY,PROVINCE) values ('Muztagh Ata','cn','Xinjiang');
Insert into INTERN.GEO_MOUNTAIN (MOUNTAIN,COUNTRY,PROVINCE) values ('Peak Pobeda','cn','Xinjiang');
Insert into INTERN.GEO_MOUNTAIN (MOUNTAIN,COUNTRY,PROVINCE) values ('Sia Kangri','cn','Xinjiang');
Insert into INTERN.GEO_MOUNTAIN (MOUNTAIN,COUNTRY,PROVINCE) values ('Skilbrum','cn','Xinjiang');
Insert into INTERN.GEO_MOUNTAIN (MOUNTAIN,COUNTRY,PROVINCE) values ('Skyang Kangri','cn','Xinjiang');
Insert into INTERN.GEO_MOUNTAIN (MOUNTAIN,COUNTRY,PROVINCE) values ('Teram Kangri','cn','Xinjiang');
Insert into INTERN.GEO_MOUNTAIN (MOUNTAIN,COUNTRY,PROVINCE) values ('Changtse','cn','Xizang');
Insert into INTERN.GEO_MOUNTAIN (MOUNTAIN,COUNTRY,PROVINCE) values ('Cho Oyu','cn','Xizang');
Insert into INTERN.GEO_MOUNTAIN (MOUNTAIN,COUNTRY,PROVINCE) values ('Chomo Lonzo','cn','Xizang');
Insert into INTERN.GEO_MOUNTAIN (MOUNTAIN,COUNTRY,PROVINCE) values ('Ganesh','cn','Xizang');
Insert into INTERN.GEO_MOUNTAIN (MOUNTAIN,COUNTRY,PROVINCE) values ('Gangkhar Puensum','cn','Xizang');
Insert into INTERN.GEO_MOUNTAIN (MOUNTAIN,COUNTRY,PROVINCE) values ('Gurla Mandhata','cn','Xizang');
Insert into INTERN.GEO_MOUNTAIN (MOUNTAIN,COUNTRY,PROVINCE) values ('Gyachung Kang','cn','Xizang');
Insert into INTERN.GEO_MOUNTAIN (MOUNTAIN,COUNTRY,PROVINCE) values ('Jongsong Peak','cn','Xizang');
Insert into INTERN.GEO_MOUNTAIN (MOUNTAIN,COUNTRY,PROVINCE) values ('Kula Kangri','cn','Xizang');
Insert into INTERN.GEO_MOUNTAIN (MOUNTAIN,COUNTRY,PROVINCE) values ('Lhotse','cn','Xizang');
Insert into INTERN.GEO_MOUNTAIN (MOUNTAIN,COUNTRY,PROVINCE) values ('Makalu','cn','Xizang');
Insert into INTERN.GEO_MOUNTAIN (MOUNTAIN,COUNTRY,PROVINCE) values ('Mount Everest','cn','Xizang');
Insert into INTERN.GEO_MOUNTAIN (MOUNTAIN,COUNTRY,PROVINCE) values ('Mount Godwin Austen','cn','Xizang');
Insert into INTERN.GEO_MOUNTAIN (MOUNTAIN,COUNTRY,PROVINCE) values ('Namcha Barwa','cn','Xizang');
Insert into INTERN.GEO_MOUNTAIN (MOUNTAIN,COUNTRY,PROVINCE) values ('Shishapangma','cn','Xizang');im using oracle11g and ubuntu 12,4
thank u in advance.
best,
david

In that case you need to do a Outer join. A Inner join will still give the same result.
Something like this
select min(cnt) min_count, max(cnt) max_count
  from (
          select geo.mountain, count(distinct province) cnt
            from mountain m
            left join geo_mountain geo
            on geo.mountain=m.name
           group by m.name
select min(cnt) min_count, max(cnt) max_count
  from (
          select geo.province, count(distinct mountain) cnt
            from province p
            left join geo_mountain geo
            on p.name=geo.province
           group by geo.province
       );Edited by: Karthick_Arp on May 2, 2013 3:51 AM
Added query

Similar Messages

  • Outer join query for SQL server from Oracle

    Hi All,
    My question is regarding making queries from Oracle to SQL Server database thorugh DBLink.
    In my oracle database I have a DBLink emp.world for SQL Server database.
    I need to query SQL Server data from oracle (so that this query can be combined with other oracle tables).
    Query is given below:
    SELECT
            a."EmpID" as "Employee ID",
            a."EmpStatus" "Employee Status"
            b."EmpSub" as "Employee Subjects"
    FROM
            [email protected] a
            left outer join [email protected] b on a."EmpID" = b."suEmpID"
    ORDER BY  a."EmpID";My problem is when I run the same query from oracle, it does not show the EmpID that does not exist in Subjects table, but when run from actual SQL Server database, it shows all the records.
    Samples are given below:
    Run from Oracle
    Employee ID      Employee Status     Employee Subjects
    101                     Active                     Maths
    102                     Active                     Maths
    102                     Active                     Physics
    104                   Inactive                  Chemistry
    Run form SQL Server
    Employee ID      Employee Status     Employee Subjects
    101                     Active                     Maths
    102                     Active                     Maths
    102                     Active                     Physics
    103                 Active                       NULL
    104             Inactive            ChemistryI am not sure why in oracle outer join for SQL server tables is not working. What is the right way for outer join in this case.
    I am using oracle database 10gR2 and SQL Server 2005.
    Please Help.
    Thanks.

    SELECT
    a."EmpID" as "Employee ID",
    a."EmpStatus" "Employee Status"
    b."EmpSub" as "Employee Subjects"
    FROM
    [email protected] a
    left outer join [email protected] b on a."EmpID" = b."suEmpID"
    ORDER BY a."EmpID";
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/queries006.htm#sthref3175
    From your description, it appears you may need a right outer join. You want to get back all the rows from 'B', not from 'A'. Try a right join and let us know.

  • Join query for three tables

    Hi i have got this query that is a join of two tables but i need join for three tables i need the extended query
    select aauthlname aauthlnam aauthfname aauthfnam aisbn btitle
      from ( bsauthors as a inner join bsbook as b on aisbn = bisbn )
      into corresponding fields of table books
      where aauthlname like authorlname or aauthfname like authorfname
      order by aauthlname aauthfname a~isbn.

    Hi pavan
    Plz try the following querry for joins on three tables :
    " Customize it to ur requirements and tablenames
    Parameters : b type mara-matnr.
    select xmatnr xmtart xmatkl ywerks ylgort zmaktx
    into corresponding fields of table itab
         from (  ( mara as x inner join mard as y on xmatnr = ymatnr )
    inner join makt as z on xmatnr = zmatnr ) where x~matnr = a and
    y~werks
    = b .
    Plz see that there is atleast one field common between the three tables u want to use.
    Regards
    Pankaj

  • How to use the result of a sql query for a max () function

    Hi
    I wrote a query on which i wrote
    "select max(id) from users "
    how can i use the returned value.
    if i made the var name ="userid"
    can it be userid.rows[0] or what.
    thnx for any help

    Hi!
    The result of this query will be the max ID of users' IDs.
    Let say we have:
    String sql="select max(users.id) from users";
    Statement st = ctx.conn.createStatement();
    ResultSet rs = st.executeQuery(sql);
    rs.next();     
    So you can get the max Id in the following way:     
    int maxId=rs.getInt("id");
    Regards,
    Rossi

  • Sql join query join

    Hi I have 3 tables.
    Table                   columns
    1. Buy                     buyer,sellername
    2. IM                      product,hdate,UOM,dept,sec,subsec
    3. stud                    dept,sec,subsecRequired O/P with columns as :
    buyer   product   dept  sec  subsec
    ---------------------------------------------------so please send me the join query for this.
    Thank you.

    I am getting the output with the above mentioned query as
    buyer   product  dept    class     subsecs
    90      glass    203     310      234
    120     glass    203     310      234
    354     glass    203     310      234
    435     belts    330     243      890
    435     belts    330     243      890
    ...like this I am getting the result...
    So please help me in this issue..
    Thank you.

  • Updatable ResultSet for join Query

    Hi all,
    It is inevitable that i use a 'JOIN' operation for a particular query and i need the resultSet to be updated. Heard JDBC driver doesnt support this. Is there any workaround for this. Any help is really appreciated.
    Thanks,
    Abhijit

    Welcome to the forum!
    >
    It is inevitable that i use a 'JOIN' operation for a particular query and i need the resultSet to be updated. Heard JDBC driver doesnt support this.
    >
    As gimbal2 mentioned this isn't supported even by the latest 11g version and driver. See 'Result Set Limitations' in Chapter 17 of the JDBC doc for confirmation and discussion.
    http://docs.oracle.com/cd/E14072_01/java.112/e10589/resltset.htm#BABBCECI
    >
    Result Set Limitations
    The following limitations are placed on queries for enhanced result sets. Failure to follow these guidelines will result in the JDBC driver choosing an alternative result set type or concurrency type.
    To produce an updatable result set:
    A query can select from only a single table and cannot contain any join operations.
    In addition, for inserts to be feasible, the query must select all non-nullable columns and all columns that do not have a default value.
    A query cannot use SELECT * .
    However, there is a workaround for this.
    A query must select table columns only.
    It cannot select derived columns or aggregates, such as the SUM or MAX of a set of columns.
    >
    >
    Actually my exact requirement is i have two tables, earlier i used to select the results from one table and check for the existance of the corresponding record in the second table from the output of resultset. This is causing a lot of performance issue and i thought of using a single query by joining two tables which reduces the number of records.
    >
    So is this a correct description of what you want to do?
    1. TableA and TableB have one or more columns in common.
    2. Query TableA, possibly using filter predicates (WHERE tabA.col1 ...) and identify records in TableB that match on the join columns
    3. Update the TableB records from step #2.
    If so then you have a couple of options.
    The record-by-record approach would be to execute your current query (the one that joins the two tables) but retrieve ONLY the ROWID from TableB. Then iterate thru the result set and use a separate query to get each TableB record by using the ROWID retrieved from the first query. This is different from your original approach because the first query WILL identify the TableB records you need it just won't retrieve them (only the ROWID).
    Your original performance issues were probably because you were retrieving ALL of the TableA records and then checking each one to see if there were any TableB records for it.
    The BULK approach would be a slight modification of of the record-by-record approach but pushes the work to the DB server.
    This approach queries TableB to retrieve ONLY those records that EXIST in the query of TableA just described. So the query is of the form
    SELECT * FROM TableB b WHERE EXISTS (SELECT '1' FROM TableA a WHERE a.col1 = b.col1);  This query only uses one table for the resultset and does not contain any join operators so it can be updateable.
    Test a simple query first until you get the syntax correct.

  • Warning in query in Extended Syntax Check

    Hi all,
    I perform Extended Syntax Check.
    It generates following warning for the query: -
    In "SELECT SINGLE....", the WHERE condition for the key field "MATNR" does not test for equality. Therefore the single record in question may not be unique.
    (You can hide the message using "#EC *)
    Please tell me what does it mean. How can I suppress this warning?
    Regards,
    Saurabh A. Buksh

    Hi,
    whenu r using select single use a variable or a workarea don't use tables.
    select single matnr from mara into v_matnr
    where matnr in s_matnr.
    also as it is warning message u can neglectit .
    when u  r using select single u should give entire key information also.
    Regards,
    Nagaraj
    Message was edited by: nagaraj kumar nishtala

  • Extended Program Check Warning For Syntax Check

    Warning:
    Syntax Check Warning
    This Warning only Displayed in SLIN
    WHERE lgtyp IN S_LGTYP.
      Messages :
      In "SELECT SINGLE...", the where condition for the key field "LGTYP" does not test  for equality .
      There fore the single record yuor searching may not be unique.
    IF NOT S_LGTYP[] IS INITIAL.
        SELECT SINGLE * FROM T301
         WHERE lgtyp IN S_LGTYP.----
    >IT SHOWING THIS LINE
        IF SY-SUBRC NE 0.
          MESSAGE E005(Z01).
        ENDIF.
    ENDIF.

    Hi Raghu,
    When you are using SELECT SINGLE, it is always better to use EQ in the condition than IN.
    Instead of using select-options S_LGTYP, declare a parameter: P_LGTYP and if possible re-write the select query as below:
    SELECT SINGLE * FROM T301 into lv_variable
    WHERE lgtyp EQ  P_LGTYP .
    Regards
    Deepa.

  • Is there a reliable method for detecting that a query is too large?

    I am writing some code (that uses OCI) to properly detect when a query string is too long for OCI and/or the Oracle database server. I can't find any specific error code information in the docs, so I just started firing off large queries to see what would happen.
    The queries I am sending are >2MB in size, up to 16MB. If the queries are above ~10MB, I get the error "ORA-03113 'End-of-file on communications channel'" after a fairly short amount of time (i.e. not enough for a timeout to expire). If the queries are below ~10MB, but above ~2.5MB, it either just sits there and does not do anything (for more than 15 hours). So watching for ORA-03113 when executing large queries does not seem like a very reliable method for detecting the queries that are too large.
    Does anyone know of a reliable way of detecting that a query is too large for the OCI client and/or the Oracle database server?
    I am using version 10.2.0.1 for both the OCI client and the Oracle database server, but I'm getting similar errors for combinations of 10.2.0.1 and 9.2.0.7 for both the OCI client and the Oracle database server.
    These large queries need to be handled properly (i.e. distinguished from some generic failure) because the server handles requests from users, which could be programs that generate SQL queries (and have constructed huge ones in the past).
    Thanks for any information!

    The ORA-03113 means that the Oracle server process has died trying to satisfy your request. In almost all cases it is strictly correct to call that a bug, and we shouldn't easily forgive the server process when it happens. But in the case of multimegabyte statements my anger and disapointment turns to sympathy, for in my heart I can't bring myself to blame it. Can you?

  • Syntax check for tables and function modules

    Hi,
    I am writing a program that perform syntax check on object such as executable programs , function modules and tables.
    Syntax check works fine for programs, but not for tables.
    How can I perform syntax check on my tables or structures?
    I get my data from the table TADIR. But I don't get my function modules from there. What is the table for this.
    Thanks 4 ur replies.
    Parvez

    hi
    good
    generally in sap while creating a table or structure we get the error and we solved them,but like reports during runtime it is not possible to check the syntax of a table or structure.
    thanks
    mrutyun^

  • Error in Extended syntax check- Select Query

    Hi all,
    Iam getting this following error in Extended syntax check
    " Large table PA0002: No field of a table index in WHERE
    condition"
    Code :SELECT SINGLE PERNR INTO (G_PERNR) FROM PA0002 WHERE ZZLEGACY_PAYROLL = I_FILETAB-PRNO
                                                           AND ZZLEGACY_PAYSYS = I_FILETAB-PRSYS
                                                           AND ZZLEGACY_PAYINS = I_FILETAB-PRINS.
    can anyone help on this?

    Hi,
    Change the code like this and check............
    For this u need put INSIDE LOOP.
    Select single PERNR into G_PERNR from PA0002 where PERNR = I_FILETAB-PRNO and .......... and ......
    Check like this...
    Thanks.
    If this helps you reward with points.
    Message was edited by: KDeepak
    Message was edited by: KDeepak

  • No upgrade check query for B1 8.8 in Note 1000846

    Hi Experts,
    I see that there is no upgrade check for B1 8.8 in SAP note 1000846 untul present. Is it difficult to develop it or just use existing one ? I am not sure if we can go on to upgrade without the query of upgrade check.
    Steve

    Dear Steve,
    In Business One 8.8 version Pre-Upgrade checks are a part of the Upgrade Wizard. SAP Note [1357462|https://websmp130.sap-ag.de/sap(bD1odSZjPTAwMQ==)/bc/bsp/spn/sapnotes/index2.htm?numm=1357462] encloses all the SAP Notes for pre-upgrade checks. Always refer to this collective SAP Note for the latest pre-upgrade check list and details.
    For more information regarding Pre-Upgrade Checks under 8.8 please refer to the "Upgrade Wizard Online Help" or to the "Administrator's Guide 8.8 SQL", which can be found on the Documentation Resource Centre on the Portal.   
    hope it helps,
    Regards,
    Ladislav Meszaros
    SAP Business One Forum Team

  • Syntax Check for *.java files

    Hello erveryone,
    I'm wondering if anybody has an advice how to enable (if possible) syntax check in JDeveloper 10.1.2.
    For example:
    public String toString() {
    String result = "test";
    The missing return statement is not shown in the editor. It's only shown by the compiler.
    Thanks in advance
    Alex

    Thanks for your reply,
    I checked out the links you mentioned, but I think the informations about the code editor and the code assist are not very detailed.
    I checked out the tool you mentioned above (PMD) and it was quite fine unsing it for one class. But I tried to check about 300 classes at a time and it hangs after a few minutes.
    So I think it's a little improvement, but I will still look for a tool compareable to eclipse.

  • Syntax check for a software component

    Hi all,
    is there a way to run a syntax check for all objects of a software component?
    Means triggering the check at software component level.
    Thanks and regards!
    Kerstin

    Hi Kerstin
    I think basis guy should know this, it`s on software component level.
    i know a tcode 'SGEN', but this is used to define a background job then compiling the software component. I`m not sure the background job log whether have this kind of error message if there are SYNTAX error.
    regards,
    Archer

  • Function for syntax check on the repository objects

    Hi Experts,
         Can anyone help me in finding out the function module used to do syntax check on Repository objects(PRograms/Smartforms/FUnction Modules...etc.,)
    Regards
    Arif Shaik

    >
    a.shaik wrote:
    > I hope I have sent the query on the ABAP forum itself
    You have posted the query on SAP PI/ XI forum....ABAP forum is different: ABAP Development
    Regards,
    Abhishek.

Maybe you are looking for

  • How to use CRM_COPY_BADI

    Hi Experts, My Requirement is to create Service Order Contract Quotations with the creation date as Service Contract End date + 1 that mean Service Order Contract Quotations( Creation Date ) = Service Contract (End date + 1). So i am using CRM_COPY_B

  • Panel content not loaded in non-english Photoshop

    Hello. I have created this Panel ( http://circografico.com.ar/shop/downloads/ad-artbox-lite/ ) that works perfect in Photoshop CS6 - english version - both in Windows and Mac, but when someone try to use it in a spanish Photoshop version, it loads a

  • Metadata Consistency warnings error.....need help

    I'm getting this error when i run my reports. I checked in all my files and I'm not seeing any consistency warnings. Can someone tell me why and how i can fix this error? Odbc driver returned an error (SQLExecDirectW). Error Details Error Codes: OPR4

  • How do i make a lottery checker using numbers 09?

    Hey guys, i need a little help... i really need to make a lottery checker, i'm tired of checking ticket by ticket, but i don't know how to make it using numbers 09... Anyone know how to do it? please help me, thanks

  • How can I improve the sound quality of my new iPod?

    Hey there, I just received my new iPod with my new MacBook Pro computer. I have read every bit of documentation i received plus I have scoured resources here on the forum, but I am baffled. I just synced my iPod for the first time to my Macbook, iTun