SQL query involving multiple tables

I have a scenario in SQL where For each post there are associated tags. A user is one who makes post and he belongs to a particular location. The location corresponds to a particular country.
I create tables as
CREATE TABLE post_table
post_id VARCHAR(20),
user_id VARCHAR(20),
PRIMARY KEY(post_id)
CREATE TABLE tags_table
   post_id VARCHAR(20),
   tags VARCHAR(20),
   PRIMARY KEY(tags, post_id),
   FOREIGN KEY(post_id) REFERENCES post_table(post_id) ON DELETE CASCADE
CREATE TABLE location
location_id VARCHAR(20),
country VARCHAR(20),
PRIMARY KEY (location_id)
CREATE TABLE user_info
user_id VARCHAR(20),
location_id VARCHAR(30),
PRIMARY KEY (user_id),
FOREIGN KEY(location_id) REFERENCES location(location_id) ON DELETE CASCADE
);Now, I insert values in these tables as
INSERT INTO post_table VALUES( 'p1', 'u1' );
INSERT INTO post_table VALUES( 'p2', 'u1' );
INSERT INTO post_table VALUES( 'p3', 'u2' );
INSERT INTO post_table VALUES( 'p4', 'u3' );
INSERT INTO post_table VALUES( 'p5', 'u2' );
INSERT INTO tags_table VALUES( 'p1', 'US Open' );
INSERT INTO tags_table VALUES( 'p1', 'Real good' );
INSERT INTO tags_table VALUES( 'p1', 'Madrid' );
INSERT INTO tags_table VALUES( 'p2', 'Madrid' );
INSERT INTO tags_table VALUES( 'p3', 'Rossoneri' );
INSERT INTO tags_table VALUES( 'p4', 'Milan' );
INSERT INTO tags_table VALUES( 'p4', 'Los Angeles' );
INSERT INTO tags_table VALUES( 'p5', 'Rossoneri' );
INSERT INTO location VALUES( 'loc1', 'Spain');
INSERT INTO location VALUES( 'loc2', 'England');
INSERT INTO user_info VALUES( 'u1', 'loc1' );
INSERT INTO user_info VALUES( 'u2', 'loc2' );
INSERT INTO user_info VALUES( 'u3', 'loc1' );Now I have to fire a query For each country, display the most seen tag(s)
So for this data the result should be like
Country              MostTags
Spain                Madrid
England              RossoneriPlease help me write this query guys.

Hi,
Something like this
select      country
     , tags from
             select      l.country
               , t.tags
               , dense_rank() over (     partition by l.country
                              order by count(*) desc) drn
          from      location l
               , user_info u
               , post_table p
               , tags_table t
          where      l.location_id = u.location_id
               and p.user_id=u.user_id
               and p.post_id=t.post_id
          group by l.country
               , t.tags
where drn <=1   -- rank depends on like 1,2 or 3 popular tags for each countryRegards
Anurag

Similar Messages

  • Sql query across multiple tables ina database

    I have 3 MS Access tables in database that are linked by keyed fields in the table.  Is there a way to fetch only certain records that match a criteria across all three of these tables using the database connectivity toolset VIs?

    Thanks.  I am trying to mechanize/run an SQL query like this 
    SELECT Code_Type.Code_NUM, Code_Type.Code_Word, Word_Type.Parm_Label, Word_Type.Word_Sequence, Word_Type.Num_Words, Parameter_Label.Parm_Label, Parameter_Label.Parm_Name, Parameter_Label.Num_Bits, Parameter_Label.Num_Bits
    FROM (Code_Type INNER JOIN Word_Type ON Code_Type.Code_Word = Word_Type.Code_Word) INNER JOIN Parameter_Label ON Word_Type.Parm_Label = Parameter_Label.Parm_Label;
    while using the VIs in the database connectivity toolset.  How do I code this using these VIs?  I dont see an example of a straight SQL string like this being able to be put into the VIs.

  • How to generate a query involving multiple tables(one left join others)

    Hi, all,
    I want to query a db like these:
    I need all the demographics information(from table demo) and their acr info(from table acr), and their clinical info(from table clinical), and their lab info(from table lab).
    The db is like this:
    demo->acr: one to many
    demo->clinical info: one to many
    demo->lab info: one to many
    I want to get one query result which are demo left join acr, and demo left join clinical, and demo left join lab. I hope the result is a record including demo info, acr info, clinical info, and lab info.
    How could I do this in SQL?
    Thanks a lot!
    Qian

    Thank you very, very much!
    Actually, I need a huge query to include all the tables in our db.
    We are running a clinical db which collects the patients demographics info, clinical info, lab info, and many other information.
    The Demographics table is a center hub which connects other tables. This is the main architecture.
    My boss needed a huge query to include all the information, so others could find what they need by filtering.
    As you have found, because one patients usually has multiple clinical/lab info sets, so the result will be multiplied! the number of result=n*m*k*...
    My first plan is to set time point criteria to narrow all the records with one study year. If somebody needs to compare them, then I have to show them all.
    So I have to know the SQL to generate a huge query including as many tables as possible.
    I show some details here:
    CREATE TABLE "IMMUNODATA"."DEMOGRAPHICS" (
    "SUBJECTID" INTEGER NOT NULL,
    "WORKID" INTEGER,
    "OMRFHISTORYNUMBER" INTEGER,
    "OTHERID" INTEGER,
    "BARCODE" INTEGER,
    "GENDER" VARCHAR2(1),
    "DOB" DATE,
    "RACEAI" INTEGER,
    "RACECAUCASIAN" INTEGER,
    "RACEAA" INTEGER,
    "RACEASIAN" INTEGER,
    "RACEPAC" INTEGER,
    "RACEHIS" INTEGER,
    "RACEOTHER" VARCHAR2(50),
    "SSN" VARCHAR2(11),
    PRIMARY KEY("SUBJECTID") VALIDATE
    CREATE TABLE "IMMUNODATA"."ACR" (
    "ID" INTEGER NOT NULL,
    "THEDATE" DATE ,
    "SUBJECTID" INTEGER NOT NULL,
    "ACR_PAGENOTCOMPLETED" VARCHAR2(1000) ,
    "ACR_MALARRASHTODAY" INTEGER ,
    "ACR_MALARRASHEVER" INTEGER ,
    "ACR_MALARRSHEARLIESTDATE" DATE ,
    PRIMARY KEY("ID") VALIDATE,
    FOREIGN KEY("SUBJECTID") REFERENCES "IMMUNODATA"."DEMOGRAPHICS" ("SUBJECTID") VALIDATE
    CREATE TABLE "IMMUNODATA"."CLIN" (
    "ID" INTEGER NOT NULL,
    "THEDATE" DATE ,
    "SUBJECTID" INTEGER NOT NULL,
    "CLIN_PAGENOTCOMPLETED" VARCHAR2(1000) ,
    "CLIN_FATIGUE" VARCHAR2(20) ,
    "CLIN_FATIGUEDATE" DATE ,
    "CLIN_FEVER" VARCHAR2(20) ,
    "CLIN_FEVERDATE" DATE ,
    "CLIN_WEIGHTLOSS" VARCHAR2(20) ,
    "CLIN_WEIGHTLOSSDATE" DATE ,
    "CLIN_CARDIOMEGALY" VARCHAR2(20) ,
    PRIMARY KEY("ID") VALIDATE,
    FOREIGN KEY("SUBJECTID") REFERENCES "IMMUNODATA"."DEMOGRAPHICS" ("SUBJECTID") VALIDATE
    Other tables are alike.
    Thank very much!
    Qian

  • SQL query with multiple tables - what is the most efficient way?

    Hello I am learning PL/SQL. I have a simple procedure where I need to find number of employees and departments per location as per user input of location_id.
    I have 3 Tables:
    LOCATIONS
    location_id (pk)
    location_name
    DEPARTMENTS
    department_id (pk)
    location_id (fk)
    department_name
    EMPLOYEES
    employee_id (pk)
    department_id (fk)
    employee_name
    1 Location can have 0-MANY Departments
    1 Employee has 1 Department
    Here is the query I came up with for PL/SQL procedure:
    /*Ecount, Dcount are NUMBER variables */
    SELECT SUM (EmployeeCount), COUNT(DepartmentNumber)
         INTO Ecount, Dcount
         FROM     
         (SELECT COUNT(employee_id) EmployeeCount, department_id DepartmentNumber
              FROM employees
              GROUP BY department_id
              HAVING department_id IN
                        (SELECT department_id
                        FROM departments
                        WHERE location_id = userInput));
    I do get the correct result, but I am just wondering if my query is on the right track and if there is a more "efficient" way of doing this.
    Thanks in advance for helping a newbie out.

    Hi,
    Welcome to the forum!
    Something like this will be more efficient:
    SELECT    COUNT (employee_id)               AS ECount
    ,       COUNT (DISTINCT department_id)     AS DCount
    FROM       employees
    WHERE       department_id IN (     SELECT     department_id
                        FROM      departments
                        WHERE      location_id = :userInput
    ;You should also try a join instead of the IN subquery.
    For efficiency, do only the things you need to do.
    For example, you don't need a count of employees in each department, so don't compute one. That means you won't need the in-line view, so don't have one.
    You don't need PL/SQL for this job, so don't use PL/SQL if you don't have to. (I realize this question was out of context, so you may have good reasons for doing this in PL/SQL.)
    Do all filtering as early as possible. Don't waste effort computing things that won't be used .
    A particular example of this is: Never use a HAVING clause when you can use a WHERE clause. What's the difference between a WHERE clause and a HAVING clause? The WHERE clause is applied before aggregate functions are computed, and the HAVING clause is applied after; there's no other difference. Therefore, if the HAVING clause isn't referencing an aggregate function, it could be done in a WHERE clause instead.

  • Pure SQL of Select query on multiple tables in DB Adapter

    I am trying use pure sql approach for a custom sql query on multiple tables for a DB adapter by modifying toplink_mappings.xml. But i am not getting other tables in my xsd. Please help.

    hi Ravi,
    can you pls be a bit clear? what is this about? where you are using?
    thanks,
    sneha.

  • BaseTableName blank when calling GetSchema on a query with multiple tables

    I am using ODP.NET 11.2.0.3.0 and when calling GetSchemaTable on a DataReader that contains a join the returned SchemaTable has the BaseTableName and BaseColumnName fields blank - this is different than what I see with the Oracle OLE DB Provider and with how SQL Server's native provider works. I can't find any discussion of this - is this on purpose or is it a bug? why does the available schema information vary so drastically between a single table query and a query with multiple tables joined?
    Thanks,
    Bryan Hinton

    Hi Bryan,
    I am also facing the same issue. Did u find any work around or any suggestions will be well appreciated.
    Thanks,
    Naresh.

  • Can't  write right sql query by two tables

    Hello
    Everyone,
    I am trying to get a sql query by two tables,
    table:container
    <pre class="jive-pre">
    from_dest_id     number
    ship_from_desc     varchar
    to_dest_id     number
    </pre>
    table: label_fromat (changeless)
    <pre class="jive-pre">
    SORT_ORDER     number
    PREFIX     varchar2
    VARIABLE_NAME varchar2
    SUFFIX varchar2
    LF_COMMENT varchar2
    </pre>
    the sql which i need is
    a. table CONTAINER 's each column should have LABLE_FORMAT 's PREFIX before and SUFFIX back ,and these columns is connected
    example : the query output should be like this :
    <pre class="jive-pre">
    PREFIX||from_dest_id||SUFFIX ||PREFIX||ship_from_desc||SUFFIX ||PREFIX|| to_dest_id||SUFFIX
    </pre>
    every PREFIX and SUFFIX are come from LABEL_FORMAT's column VARIABLE_NAME (they are different)
    column SORT_ORDER decide the sequence, for the example above: Column from_dest_id order is 1, ship_from_desc is 2,to_dest_id is 3
    b. table LABEL_FORMAT's column VARIABLE_NAME have values ('from_dest_id','ship_from_desc','to_dest_id')
    If table CONTAINER only have one record i can do it myself,
    But actually it is more than one record,I do not know how to do
    May be this should be used PL/SQL,or a Function ,Cursor ,Procedure
    I am not good at these
    Any tips will be very helpful for me
    Thanks
    Saven

    Hi, Saven,
    Presenting data from multiple rows as a single string is called String Aggregation . This page:
    http://www.oracle-base.com/articles/10g/StringAggregationTechniques.php
    shows many ways to do it, suited to different requirements, and different versions of Oracle.
    In Oracle 10 (and up) you can do this:
    SELECT     REPLACE ( SYS_CONNECT_BY_PATH ( f.prefix || ' '
                                   || CASE  f.variable_name
                                        WHEN 'FROM_DEST_ID'
                                       THEN  from_dest_id
                                       WHEN 'SHIP_FROM_DESC'
                                       THEN  ship_from_desc
                                       WHEN 'TO_DEST_ID'
                                       THEN  to_dest_id
                                      END
                                   || ' '
                                   || f.suffix
                               , '~?'
              , '~?'
              )     AS output_txt
    FROM          container     c
    CROSS JOIN     label_format     f
    WHERE          CONNECT_BY_ISLEAF     = 1
    START WITH     f.sort_order     = 1
    CONNECT BY     f.sort_order     = PRIOR f.sort_order + 1
         AND     c.from_dest_id     = PRIOR c.from_dest_id
    saven wrote:If table CONTAINER only have one record i can do it myself,
    But actually it is more than one record,I do not know how to do In that case, why did you post an example that only has one row in container?
    The query above assumes
    something in container (I used from_dest_id in the example above) is unique,
    you don't mind having a space after prefix and before from_dest_id,
    you want one row of output for every row in container, and
    you can identify some string ('~?' in the example above) that never occurs in the concatenated data.

  • SQL Query involved to Generate the reports

    Hi,
    I have created Vendor report which internally refers two tables from the vendor and store table (Both the tables are not directly Joined each other)
    i want to see the SQL Query involved to generate the report.
    where can i see that?
    Regards,
    Prasanthi

    in nqquery.log file:
    10g -> $BI_ORACLE_HOME/server/Log
    11g -> $ORACLE_INSTANCE/diagnostics/logs/OracleBIServerComponent/coreapplication_obis1

  • Finding the Text of SQL Query causing Full Table Scans

    Hi,
    does anyone have a sql script, that shows the complete sql text of queries that have caused a full table scan?
    Please also let me know as to how soon this script needs to be run, in the sense does it work only while the query is running or would it work once it completes (if so is there a valid duration, such as until next restart, etc.)
    Your help is appreciated.
    Thx,
    Mayuran

    Finding the Text of SQL Query Causing Full Table Scan

  • Dbms_xmlgen.newcontext query from multiple tables and ||

    I have two questions
    How do I get a dbms_xmlgen.context to query from multiple tables? I have been able to make it work with using one table only, but not with multiple tables.
    And how to get the || (concat) to work within my query for my output to an xml file?
    Here is my current query:
    create or replace function get_xml return clob is
    result clob;
    qryctx dbms_xmlgen.ctxHandle;
    SELECT DBMS_XMLGEN.getxml('select prefix, suffix, fiscal_yr
    FROM rcv.recv_accessions ra
    where ra.prefix = 8 and ra.fiscal_yr = 11')xml into result FROM dual;
    result := DBMS_XMLGEN.getXML(qryCtx);
    This is what I desire:
    SELECT DBMS_XMLGEN.getxml('select ra.prefix||'-'|| ra.suffix||'-'|| ra.fiscal_yr accession, ss.date_in, st.test
    FROM rcv.recv_accessions ra, ser.sero_samples ss, ser.sero_tests st
    where ra.prefix = 8 and ra.fiscal_yr = 11 and ss.raid = ra.id and st.ssid = ss.id')xml into result FROM dual;
    On this both the reference to multiple tables and the concat function cause errors.
    Thank you
    Edited by: user583094 on Mar 2, 2011 3:36 PM

    Hi,
    for the concat do I use xmlconcat?No, XMLConcat is used to concatenate XMLType fragments.
    The || operator will do fine, but you must escape any single quote inside the string :
    SELECT DBMS_XMLGEN.getxml(
    'SELECT ra.prefix ||''-''|| ra.suffix ||''-''|| ra.fiscal_yr as accession,
            ss.date_in,
            st.test
    FROM rcv.recv_accessions ra,
          ser.sero_samples ss,
          ser.sero_tests st
    WHERE ra.prefix = 8
    AND ra.fiscal_yr = 11
    AND ss.raid = ra.id
    AND st.ssid = ss.id'
    INTO result
    FROM dual;Or, use the quoting operator to define a custom string delimiter :
    SELECT DBMS_XMLGEN.getxml(
    q'{SELECT ra.prefix ||'-'|| ra.suffix ||'-'|| ra.fiscal_yr as accession,
            ss.date_in,
            st.test
    FROM rcv.recv_accessions ra,
          ser.sero_samples ss,
          ser.sero_tests st
    WHERE ra.prefix = 8
    AND ra.fiscal_yr = 11
    AND ss.raid = ra.id
    AND st.ssid = ss.id
    INTO result
    FROM dual;BTW, a good practice would be to use bind variables for the query. DBMS_XMLGEN can handle them nicely :
    CREATE OR REPLACE FUNCTION get_xml
    RETURN CLOB
    IS
    qryctx   DBMS_XMLGEN.ctxHandle;
    v_out    CLOB;
    qrystr   VARCHAR2(4000) :=
    'SELECT ra.prefix ||''-''|| ra.suffix ||''-''|| ra.fiscal_yr as accession,
            ss.date_in,
            st.test
    FROM rcv.recv_accessions ra,
          ser.sero_samples ss,
          ser.sero_tests st
    WHERE ra.prefix = :b_prefix
    AND ra.fiscal_yr = :b_fiscal_yr
    AND ss.raid = ra.id
    AND st.ssid = ss.id';
    BEGIN
    qryctx := DBMS_XMLGEN.newContext(qrystr);
    DBMS_XMLGEN.setBindValue(qryctx, 'b_prefix', '8');
    DBMS_XMLGEN.setBindValue(qryctx, 'b_fiscal_yr', '11');
    -- to generate empty elements if necessary :
    DBMS_XMLGEN.setNullHandling(qryctx, DBMS_XMLGEN.EMPTY_TAG);
    v_out := DBMS_XMLGEN.getXML(qryctx);
    DBMS_XMLGEN.closeContext(qryctx);
    RETURN v_out;
    END;

  • Get column names into a VB program, for an SQL query that joins tables

    use [mydatabase]
    select * from InvNum inum
    left join _btblInvoiceLines ilin
    on inum.autoindex = ilin.iinvoiceid
    left join stkitem s
    on ilin.istockcodeid = s.stocklink where InvNumber = 'IVQ0834' or InvNumber = 'IVQ0835'
    I need to get out the column names in a VB program in the same order they would appear in the SQL query above...
    I want to use something like:
    select column_name from information_schema.columns where TABLE_NAME = ....
    except there are several tables involved above so I dont know the format!

    If you execute the query in your program using the SqlDataReader.ExecuteReader method, the column names will be available via the GetName method of the returned reader.  But note that your query may return multiple columns with the same name.
    Dim reader As SqlDataReader = command.ExecuteReader()
    For x = 0 To reader.FieldCount - 1
    Console.WriteLine(reader.GetName(x))
    Next x
    Dan Guzman, SQL Server MVP, http://www.dbdelta.com

  • Mysql query (search multiple tables in database)

    I have 12 tables in a database - january through to december.
    I need to search all 12 tables for 'keyworrd' phrases submitted by the user through a search form.
    Must be a more streamlined way of doing it than below using 'UNION'. I have incorporated 2 tables in the below query but  I need a more 'condensed' query for all 12 tables?
    $sql = ('SELECT * FROM january WHERE tourTitle = "'.$keyword.'" UNION SELECT * FROM february WHERE tourTitle = "'.$keyword.'"');
    Cheers
    Os

    bregent wrote:
    >That's what I did last year but  thought I'd break it down this year into 12 easier to work with tables.
    No, Ben is correct. Using 1 table for each month is absolutely the wrong way. It violates basic rules of normalization and causes all sorts of problems.
    >Breaking it down appeals to be more so I can keep all the relevant months
    >together instead of potentially becoming scattered throught-out one table.
    That's what you use the Order By clause for.
    >If by any chance the client says they want to update x, y or z I can go
    >straight to the month in question without the necessity to flip through
    >dozens of pages in phpMyAdmin as there is no real CMS management in place for this process.
    Not sure what you are saying. Performing inserts, updates and queries is much simpler using a single table.
    Whenever someone asks for a way to search through multiple tables, it tells me that the data structure is not designed well.
    When I did this job last year there was about 60 pages created in phpMyAdmin. The records for January could be anywhere on those 60 pages as I may have to add additional records much later on in the process.
    My thinking behind this was to keep all the month entries together so I could view them easily in phpMyAdmin.
    Now due to my lack of knowlege about phpMyAdmin it could be possible to create a query to show only the january entries, I suspect it can do this.
    I agree it is a lot simpler using 1 table to select and search through BUT I need if the ocassion arises to be able to view all the january or february entries etc one after the other, not 10 on page 2 and 3 on page 7 and 5 more on page 47 of phpMyAdmin.
    So i quess what I really need is to write a select query in phpMyAdmin which only shows the selected entries for the month requested. I have not done much investigation into what phpMyAdmin can do........so I suppose I need to.
    EDITED:
    Arrgh you see IT WAS SO SIMPLE:
    SELECT * FROM `tours` WHERE month = "March"
    It's because I'm frightened of the bloody thing in case I mess something up!

  • Creating a tree query on multiple tables

    I have been reading the following article:
    http://www.oracle.com/technology/oramag/webcolumns/2003/techarticles/gennick_connectby.html#f1
    The diagram 1b that the above links to shows a local government hierrachy structure stored in multiple tables. I am having a little difficulty understanding how you would write a query (using start with connect by syntax) to get the data displayed in a tree format??
    ie: (spaces are being removed so replaced them with --)
    state1
    --county1
    --county2
    ----township1
    ----township2
    --county3
    state2
    state3
    --county3
    --county4                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    hi, please post a sample data it would help us to further analyze. thanks.
    here is some example that might help
    NODE_DATA                                NODE_PAREN
    CAR                                      TRANSPORT
    PLANE                                    TRANSPORT
    BIKE                                     TRANSPORT
    TRANSPORT
    HONDA                                    CAR
    747-400                                  PLANE
    MAZDA                                    CAR
    FOOD
    FRUIT                                    FOOD
    VEGETABLE                                FOOD
    SPINACH                                  VEGETABLE
    CARROT                                   VEGETABLE
    12 rows selected.
    SQL> select substr(rpad(' ',decode(level,1,0,2,2,4),' ')||node_data,1,20) node_data
      2    from myTreeData
      3  start with node_parent is null
      4  connect by node_parent = prior node_data;
    NODE_DATA
    TRANSPORT
      CAR
        HONDA
        MAZDA
      PLANE
        747-400
      BIKE
    FOOD
      FRUIT
      VEGETABLE
        SPINACH
        CARROT
    12 rows selected.
    SQL>

  • No Resultset for query containing multiple tables

    Hi, I am new to Oracle and I have a problem concerning the Oracle datasource/query I am using.
    I am using Websphere Application Server v5.1 Test environment, which connects to an Oracle 10g database and a DB2 database.
    So basically, I have 2 datasources in my webservice application, one for each database. I have tested both datasources from the admin console of the server and both return no errors. Both datasources are loaded on startup of the application and again, there are no errors.
    The problem basically is that I have no resultset elements ( rs.next() is false ) when I have a query that queries multiple tables.
    Eg. Case1: Select * From table1
    Case2: Select * From table1, table2
    Case3: Select * From table1 t1 INNER JOIN table2 t2 on t1.column = t2.column
    Case1: Contains resultset
    Case2 and Case3: NO resultset
    When these queries (case 2 and case3) are run from within the webservice application, there is no resultset; only case1 returns a resultset. However, if I run the same queries above from within Oracle SQL developer, there is a resultset containing the matching records. This problem only happens when using the Oracle datasource; the same problem does not happen for the DB2 datasource.
    Basically, I do not have any resultset for a valid query and there aren't any errors as well.
    Any ideas as to why this happens?
    Thanks for any help.
    Edited by: user11220677 on Jun 3, 2009 3:08 AM

    Finally got to the bottom of this. Turns out that the problem has nothing to do with the Oracle datasource in the webservice application, as what I have initiially thought.
    The cause of the problem seems to be related to an import problem/issue in the Oracle SQL developer. Everytime I open Oracle SQL developer, one table (table2 in my example from previous post) is missing its data, so I import the data using the application's import wizard. Once the import is done, I use SQL developer's query interface to verify the data is there, and there are records returned - which made me think the database table was updated successfully. The problem was, I still do not have results when the query is run from the webservice containing the datasource.
    We used another SQL command editor to verify if the said table was really updated in the database and to our surprise, it was still empty (even after the import from Oracle SQL developer). That explains why I am not able to retrieve anything from the webservice.
    We just imported the data using another SQL command editor and the issue is now fixed.
    Thanks anyway.

  • How to use one query against multiple table and recieve one report?

    I have duplicate tables, (except for their names of course) with commodities prices. They have the same column headings, but the data is different of course. I have a query that gives me a certain piece of information I am looking for but now I need to run this query against every table. I will do this every day as well, to see if the buying criteria is met. There are alot of tables though (256). Is there a way to say run query in all tables and return the results in one place? Thanks for your help.

    hey
    a. the all 256 tables whuld be one big partitoned table
    b. you can use all_tables in order to write a select that will write the report for you:
    SQL> set head off
    SQL> select 'select * from (' from dual
      2  union all
      3  select 'select count(*) from ' || table_name || ' union all ' from a
      4  where table_name like 'DB%' AND ROWNUM <= 3
      5  union all
      6  select ')' from dual;
    select * from (
    select count(*) from DBMS_LOCK_ALLOCATED union all
    select count(*) from DBMS_ALERT_INFO union all
    select count(*) from DBMS_UPG_LOG$ union all
    remove the last 'union all', and tun the generated quary -
    SQL> set head on
    SQL> select * from (
      2  select count(*) from DBMS_LOCK_ALLOCATED union all
      3  select count(*) from DBMS_ALERT_INFO union all
      4  select count(*) from DBMS_UPG_LOG$
      5  );
      COUNT(*)
             0
             0
             0
    Amiel

Maybe you are looking for

  • Float value giving exception.

    Hi, I am using a bean for a shopping cart. I used this code public float getCost()           Enumeration enum=hashtable.elements();           String[] tmpItem;           float totalCost=0.00f;           while(enum.hasMoreElements())                tm

  • No Planning file entry created  for the Rervation

    Hi PM Gurus, When we create a maintenance order, for the component the Reservation is created. The components is externally procured with the some planned delivery dates. but during the MRP run these Planned Orders are not converted to PReqs automati

  • Photos still in iCloud with no connection

    When I disconnect from wifi and cellular I can still see the photos that I have in iCloud. Its not a problem but I thought this photos should disappeared since I don't have an internet connection. How does it work? thanks!

  • My hp pavilion laptop is bad. please tell me what to do... thanks

    how do l fix my hp laptop window 8 battry?

  • BI Query Statistic - Delta Update for 0TCT_C01.

    Hi gurus, I have installed certain Standard content objects (Infoproviders and respective queries). One of such infoprovider is 0TCT_C01. I donot have a process chain for this infoprovider, hence I load data every morning manually into this cube via