HELP with lineage.sql

I need help with the discoverer lineage.sql that allows hyper drill from V5 OWB Eul into OWB portal.
I am still on OWB 9.0.3 and seem to have a small version problem. the portal is up, and i can jump to portal reports from within the browser ok. I have created the eul definitions in disco using the bridge. the lineage work book is working but the url being generated is the wrong format for the portal.
Does anyone know how I can sort out the lineage url construction to parse the correct format?
thanks.
Richard.

WOW! Nobody knows huh?
Well I'll let you know how I fixed it. Basically change the Disco Eul complex folder definition. After working out why the Url being contructed was wrong I changed the complex formula imbeded within the EUL object to parse the correct formula. And it now works. (I also added the hyperdrill for Impact analysis)
However the 9.03 repository is essentally a single table cmpallclasses and our table is huge. After getting the url parsing sorted, the actual underlying views were not returning data in a timely manner. Looking at the base table it has a single index, a quick bit 'o' tuning and having added three indexes my impact views return in under 2 mins which I am happy with. But my portal times out and spits out the no response from server which I think is an apache setting http.conf a generic time out. I am not sure why it may be a portal issue. I have set the owbportal to 1200 as a timeout, but something else is kicking in and killing the connex does anyone have a clue?
This is a big repository, I have around 1500 mappings now. Does anyone else have a production OWB repository of any real size?
Having sorted this out on 9.03, I am going to see how much I can apply to the 9.2 variant.
Thanks.
Richard.

Similar Messages

  • Help with an SQL Query on the Logger

    We are running UCCE 8.5(3) and need help with an SQL query. When I run the below I would also like to see skill group information(name preferably)? Any help would be greatly appreciated!
    select * from dbo.t_Termination_Call_Detail where DateTime between '10-11-2012 00:00:00:00' and
    '10-11-2012 23:59:59:59'

    David, thanks for replying.  Unfortunitly I don't know enough about SQL to put that into a query and have it return data.  Would you be able to give an example on what the query would look like?

  • Help with:   java.sql.SQLIntegrityConstraintViolationException

    Hi, guys
    I need help with the following exception: java.sql.SQLIntegrityConstraintViolationException: The statement was aborted because it would have caused a duplicate key value in a unique or primary key constraint or unique index identified by 'SQL090403155751200' defined on 'BOOK_ORDER'.
    the things is my primary key is unique, so i checked the indexes and i found that i have two 'SQL090403155751200' indexes.
    I would like to know:
    1. can i delete the index without causing further database problems
    2. what causes this problem and how can i avoid it.
    By the way im using netbeans 6.5 and derby database

    rizza_99 wrote:
    I would like to know:
    1. can i delete the index without causing further database problems
    2. what causes this problem and how can i avoid it.
    By understanding what the application/system is supposed to be doing and the correctly creating indexes on the database that reflect the business needs.
    Once you do that then the nature of the indexes that are needed are obvious.
    You certainly don't delete indexes without that understanding however.

  • Help with PL/SQl .....Sysdate-1

    Hi all ..Need help with this
    to_char(last_day(add_months(sysdate,-1)),'mm/dd/yyyy')
    Its an Oracle 10g. We use two schemas out of many for Enterprise wide DW. They have 9 base tables in one of the schemas.. We have hundreds of views from that base tables . This SQL command is against one of the view . We basically need all the applications made by customers drilled by region,area,city etc. in the last month using this command.
    Here we are using sysdate - 1 to retrieve reports for the last months data. These reports are run monthly on first business day once. But due to any problem if it runs after 3rd or 4th of the month it returns data from last months 3rd to this months 3rd which is logically wrong. Is there any solution so that whenever the report may run it has to return last months data from first of last month to last day of last month. It would be of great help if anyone gives the solution.
    Thanks
    Tom

    Tom,
    Something like this
    SELECT     ADD_MONTHS (TRUNC (SYSDATE), -1)
             - TO_NUMBER (TO_CHAR (ADD_MONTHS (TRUNC (SYSDATE), -1), 'DD'))
             + 1
                first_date,
             LAST_DAY (ADD_MONTHS (TRUNC (SYSDATE), -1)) last_date
      FROM   DUAL;Regards

  • Anybody can help with this SQL?

    The table is simple, only 2 columns:
    create table personpay(
    id integer primary key,
    pay number(8,2) not null);
    So the original talbe looks like this:
    ID PAY
    1 800
    2 400
    3 1200
    4 500
    5 600
    6 1900
    The requirement is to use one single query(no pl/sql) to show something lile the following, in other words, for each ID, the pay is the sum of all before itself and itself. So the query result looks like this:
    ID PAY
    1 800
    2 1200
    3 2400
    4 2900
    5 3500
    6 5400
    Again, just use one sql. No pl/sql. Anybody can help with this? I really appreciate that.
    thanks,

    Eh, people are so "analytically minded" that can't even notice a simple join?
    Counting Ordered Rows
    Let’s start with a basic counting problem. Suppose we are given a list of integers, for example:
    x
    2
    3
    4
    6
    9
    and want to enumerate all of them sequentially like this:
    x      #
    2      1
    3      2
    4      3
    6      4
    9      5
    Enumerating rows in the increasing order is the same as counting how many rows precede a given row.
    SQL enjoys success unparalleled by any rival query language. Not the last reason for such popularity might be credited to its proximity to English . Let examine the informal idea
    Enumerating rows in increasing order is counting how many rows precede a given row.
    carefully. Perhaps the most important is that we referred to the rows in the source table twice: first, to a given row, second, to a preceding row. Therefore, we need to join our number list with itself (fig 1.1).
    Cartesian Product
    Surprisingly, not many basic SQL tutorials, which are so abundant on the web today, mention Cartesian product. Cartesian product is a join operator with no join condition
    select A.*, B.* from A, B
    Figure 1.1: Cartesian product of the set A = {2,3,4,6,9} by itself. Counting all the elements x that are no greater than y produces the sequence number of y in the set A.
    Carrying over this idea into formal SQL query is straightforward. As it is our first query in this book, let’s do it step by step. The Cartesian product itself is
    select t.x x, tt.x y
    from T t, T tt
    Next, the triangle area below the main diagonal is
    select t.x x, tt.x y
    from T t, T tt
    where tt.x <= t.x
    Finally, we need only one column – t.x – which we group the previous result by and count
    select t.x, count(*) seqNum
    from T t, T tt
    where tt.x <= t.x
    group by t.x
    What if we modify the problem slightly and ask for a list of pairs where each number is coupled with its predecessor?
    x      predecessor
    2      
    3      2
    4      3
    6      4
    9      6
    Let me provide a typical mathematician’s answer, first -- it is remarkable in a certain way. Given that we already know how to number list elements successively, it might be tempted to reduce the current problem to the previous one:
    Enumerate all the numbers in the increasing order and match each sequence number seq# with predecessor seq#-1. Next!
    This attitude is, undoubtedly, the most economical way of thinking, although not necessarily producing the most efficient SQL. Therefore, let’s revisit our original approach, as illustrated on fig 1.2.
    Figure 1.2: Cartesian product of the set A = {2,3,4,6,9} by itself. The predecessor of y is the maximal number in a set of x that are less than y. There is no predecessor for y = 2.
    This translates into the following SQL query
    select t.x, max(tt.x) predecessor
    from T t, T tt
    where tt.x < t.x
    group by t.x
    Both solutions are expressed in standard SQL leveraging join and grouping with aggregation. Alternatively, instead of joining and grouping why don’t we calculate the count or max just in place as a correlated scalar subquery:
    select t.x,
    (select count(*) from T tt where tt.x <= t.x) seq#
    from T t
    group by t.x
    The subquery always returns a single value; this is why it is called scalar. The tt.x <= t.x predicate connects it to the outer query; this is why it is called correlated. Arguably, leveraging correlated scalar subqueries is one the most intuitive techniques to write SQL queries.
    How about counting rows that are not necessarily distinct? This is where our method breaks. It is challenging to distinguish duplicate rows by purely logical means, so that various less “pure” counting methods were devised. They all, however, require extending the SQL syntactically, which was the beginning of slipping along the ever increasing language complexity slope.
    Here is how analytic SQL extension counts rows
    select x, rank() over(order by x) seq# from T; -- first problem
    select x, lag() over(order by x) seq# from T; -- second problem
    Many people suggest that it’s not only more efficient, but more intuitive. The idea that “analytics rocks” can be challenged in many ways. The syntactic clarity has its cost: SQL programmer has to remember (or, at least, lookup) the list of analytic functions. The performance argument is not evident, since non-analytical queries are simpler construction from optimizer perspective. A shorter list of physical execution operators implies fewer query transformation rules, and less dramatic combinatorial explosion of the optimizer search space.
    It might even be argued that the syntax could be better. The partition by and order by clauses have similar functionality to the group by and order by clauses in the main query block. Yet one name was reused, and the other had been chosen to have a new name. Unlike other scalar expressions, which can be placed anywhere in SQL query where scalar values are accepted, the analytics clause lives in the scope of the select clause only. I have never been able to suppress an impression that analytic extension could be designed in more natural way.

  • Help with Oracle SQL to strip unwanted characters

    Hello,
    I have 2 columns (Weight and Height)  where I need to strip the alpha characters and convert them to numbers (I am required to derive additional columns where I need to present
    these values in inches, cm, KG, LB, etc. (and thus the need to convert them to numbers). I am too much a novice to understand the best way to convert these columns into numbers (same precision as you see here).
    See the image below for a sample of what these columns currently contain. I simply need help with the Oracle SQL code to parse/convert these vales into number. Thanks in advance for your assistance!
    Dave

    Hi,
    In addition to
    Erland Sommarskog's comment which is of course correct and this i not the forum to ask question about Oracle, I dont want to leave you without a lead :-)
    The solution both in SQL Server and Oracle should based on Regular Expressions. I highly recommended NOT to use T-SQL solutions in this case, as mentioned above, unless this is a very small table and the need is very simple and include finding one point
    in the string as in
    SaravanaC solution (when he assume thge string format is based on 2 parts (1) Number + (2) unit type).
    In Oracle there is a build in Regular Expressions option as mentioned here: http://docs.oracle.com/cd/B12037_01/appdev.101/b10795/adfns_re.htm
    In SQL Server the PATINDEX is used for simple cases and there is no built in Regular Expressions, but you can add it using CLR as shown in this link http://msdn.microsoft.com/en-us/magazine/cc163473.aspx
    [Personal Site] [Blog] [Facebook]

  • Help with oracle sql to get all possible combinations in a table.

    Hello guys I have a small predicatement that has me a bit stumped. I have a table like the following.(This is a sample of my real table. I use this to explain since the original table has sensitive data.)
    CREATE TABLE TEST01(
    TUID VARCHAR2(50),
    FUND VARCHAR2(50),
    ORG  VARCHAR2(50));
    Insert into TEST01 (TUID,FUND,ORG) values ('9102416AB','1XXXXX','6XXXXX');
    Insert into TEST01 (TUID,FUND,ORG) values ('9102416CC','100000','67130');
    Insert into TEST01 (TUID,FUND,ORG) values ('955542224','1500XX','67150');
    Insert into TEST01 (TUID,FUND,ORG) values ('915522211','1000XX','67XXX');
    Insert into TEST01 (TUID,FUND,ORG) values ('566653456','xxxxxx','xxxxx');
    "TUID"                        "FUND"                        "ORG"                        
    "9102416AB"                   "1XXXXX"                      "6XXXXX"                     
    "9102416CC"                   "100000"                      "67130"                      
    "955542224"                   "1500XX"                      "67150"                      
    "915522211"                   "1000XX"                      "67XXX"                      
    "566653456"                   "xxxxxx"                      "xxxxx"                       The "X"'s are wild card elements*( I inherit this and i cannot change the table format)* i would like to make a query like the following
    select tuid from test01 where fund= '100000' and org= '67130'however what i really like to do is retrieve any records that have have those segements in them including 'X's
    in other words the expected output here would be
    "TUID"                        "FUND"                        "ORG"                        
    "9102416AB"                   "1XXXXX"                      "6XXXXX"                     
    "9102416CC"                   "100000"                      "67130"                      
    "915522211"                   "1000XX"                      "67XXX"                      
    "566653456"                   "xxxxxx"                      "xxxxx"  i have started to write a massive sql statement that would have like 12 like statement in it since i would have to compare the org and fund every possible way.
    This is where im headed. but im wondering if there is a better way.
    select * from test02
    where fund = '100000' and org = '67130'
    or fund like '1%' and org like '6%'
    or fund like '1%' and org like '67%'
    or fund like '1%' and org like '671%'
    or fund like '1%' and org like '6713%'
    or fund like '1%' and org like '67130'
    or fund like '10%' and org like '6%'...etc
    /*seems like there should be a better way..*/can anyone give me a hand coming up with this sql statement...

    mlov83 wrote:
    if i run this
    select tuid,fund, org
    from   test01
    where '100000' like translate(fund, 'xX','%%') and '67130' like translate(org, 'xX','%%');this is what i get
    "TUID"                        "FUND"                        "ORG"                        
    "9102416AB"                   "1XXXXX"                      "6XXXXX"                     
    "9102416CC"                   "100000"                      "67130"                      
    "915522211"                   "1000XX"                      "67XXX"                      
    "566653456"                   "xxxxxx"                      "xxxxx"                      
    "9148859fff"                  "1XXXXXX"                     "X6XXX"                       the last item should be excluded. The second digit in "org" is a "7" Fund is wrong, too. You're looking for 6 characters ('100000'), but fund on that row is 7 characters ('1XXXXXX').
    and this is sitll getting picked up.That's why you should use the _ wild-card, instead of %
    select  tuid, fund, org
    from    test01
    where  '100000' like translate (fund, 'xX', '__')
    and    '67130'  like translate (org,  'xX', '__')
    ;It's hard to see, but, in both calls to TRANSLATE, the 3rd argument is a string of 2 '_'s.

  • Help with dynamic SQL

    Hello,
    I have the following function that works ok:
    CREATE OR REPLACE FUNCTION Get_Partition_Name (sTable VARCHAR2, iImportIndex INTEGER)
    RETURN VARCHAR2 IS
    cursor c is select A.partition_name from (select table_name, partition_name,
    extractvalue (
    dbms_xmlgen.
    getxmltype (
    'select high_value from all_tab_partitions where table_name='''
    || table_name
    || ''' and table_owner = '''
    || table_owner
    || ''' and partition_name = '''
    || partition_name
    || ''''),
    '//text()') import_value from all_tab_partitions) A where table_name = sTable and A.import_value = iImportIndex;
    sPartitionName VARCHAR(20);
    err_num NUMBER;
    BEGIN
    open c;
    fetch c into sPartitionName;
    IF c%ISOPEN THEN
    CLOSE c;
    END IF;
    RETURN sPartitionName;
    EXCEPTION
    WHEN OTHERS THEN
    err_num := SQLCODE;
    --save error in log table
    LOG.SAVELINE(SQLCODE, SQLERRM);
    END Get_Partition_Name;
    I am trying to replace the cursor statement with dynamic SQL, something like (see below) but it doesn't work any more; I think I am missing some quotes.
    CREATE OR REPLACE FUNCTION Get_Partition_Name (sTable VARCHAR2, iImportIndex INTEGER)
    RETURN VARCHAR2 IS
    TYPE t1 IS REF CURSOR;
    c t1;
    sSql VARCHAR2(500);
    sPartitionName VARCHAR(20);
    err_num NUMBER;
    BEGIN
    sSql := 'select A.partition_name from (select table_name, partition_name,
    extractvalue (
    dbms_xmlgen.
    getxmltype (
    ''select high_value from all_tab_partitions where table_name=''''
    || table_name
    || '''' and table_owner = ''''
    || table_owner
    || '''' and partition_name = ''''
    || partition_name
    || ''''''),
    ''//text()'') import_value from all_tab_partitions) A where table_name = :a and A.import_value = :b';
    OPEN c FOR sSql USING sTable, iImportIndex;
    fetch c into sPartitionName;
    IF c%ISOPEN THEN
    CLOSE c;
    END IF;
    RETURN sPartitionName;
    EXCEPTION
    WHEN OTHERS THEN
    err_num := SQLCODE;
    --save error in log table
    LOG.SAVELINE(SQLCODE, SQLERRM);
    END Get_Partition_Name;
    Please advise,
    Regards,
    M.R.

    Assuming the requirement is to find the partition in the supplied table with the supplied high value and the issue is that dba/all_tab_partitions.high_value is a long, one alternative along the same lines as you've done already is as follows. (I've just used a cursor rather than a function for simplicity of demo).
    SQL> var r refcursor
    SQL> set autoprint on
    SQL> declare
      2   ctx dbms_xmlgen.ctxhandle;
      3   v_table_name VARCHAR2(40) := 'LOGMNR_USER$';
      4   v_value      NUMBER       := 100;
      5  begin
      6   ctx := DBMS_XMLGEN.NEWCONTEXT
      7          ('select table_name
      8            ,      partition_name
      9            ,      high_value  hi_val
    10            from   dba_tab_partitions
    11            where  table_name     = :table_name');
    12   dbms_xmlgen.setbindvalue(ctx,'TABLE_NAME',v_table_name);
    13   open:r for
    14   with x as
    15   (select xmltype(dbms_xmlgen.getxml(ctx)) myxml
    16    from   dual)
    17   select extractvalue(x.object_value,'/ROW/TABLE_NAME') table_name
    18   ,      extractvalue(x.object_value,'/ROW/PARTITION_NAME') partition_name
    19   ,      extractvalue(x.object_value,'/ROW/HI_VAL') hi_val
    20   from   x
    21   ,      TABLE(XMLSEQUENCE(EXTRACT(x.myxml,'/ROWSET/ROW'))) x
    22   where  extractvalue(x.object_value,'/ROW/HI_VAL') = v_value;
    23  end;
    24  /
    PL/SQL procedure successfully completed.
    TABLE_NAME
    PARTITION_NAME
    HI_VAL
    LOGMNR_USER$
    P_LESSTHAN100
    100
    SQL> I'm sure there are other ways as well. Especially with XML functionality, there's normally many ways to skin a cat.

  • Please help with an sql to show more than one records into single row for each student

    From the following data I would like to create an sql to get the information  as the following layout
    studentid,  firstTerm,  EnglishMark1,ScienceMark1,MathsMark1, Secondterm,EnglishMark2,ScienceMark2,MathsMark2,
    ThirdTerm,EnglishMark3,ScienceMark3,MathsMark3 // As single rows for each student
    Example
    1 First, 30,40,20,Sec,30,40,20,  simillarly next row for next row for another sudent. Please help to generate the sql for the same.
    Please help it would be very appreciate.
    With Thanks
    Pol
    polachan

    create table yourdata (studentid int, term varchar(10), section varchar(50), Mark int)
    insert into yourdata values
    (1,'First','Math',20),(1,'First','English',30),(1,'First','Science',40),
    (2,'First','Math',20),(2,'First','English',30),(2,'First','Science',40),
    (3,'First','Math',20),(3,'First','English',30),(3,'First','Science',40),
    (1,'Sec','Math',20),(1,'Sec','English',30),(1,'Sec','Science',40),
    (2,'Sec','Math',20),(2,'Sec','English',30),(2,'Sec','Science',40),
    (3,'Sec','Math',20),(3,'Sec','English',30),(3,'Sec','Science',40)
    Select studentid
    ,max(case when term='First' and section='English' Then Mark End) as EnglishMark1
    ,max(case when term='First' and section='Science' Then Mark End) as ScienceMark1
    ,max(case when term='First' and section='Math' Then Mark End) as MathMark1
    ,max(case when term='Sec' and section='English' Then Mark End) as EnglishMark2
    ,max(case when term='Sec' and section='Science' Then Mark End) as ScienceMark2
    ,max(case when term='Sec' and section='Math' Then Mark End) as MathMark2
    ,max(case when term='Third' and section='English' Then Mark End) as EnglishMark3
    ,max(case when term='Third' and section='Science' Then Mark End) as ScienceMark3
    ,max(case when term='Third' and section='Math' Then Mark End) as MathMark3
    From yourdata
    Group by studentid
    drop table yourdata

  • Help with structuring SQL databases for multiple photo galleries..help!?!

    Hello all,
    As a new PHP/SQL developer I have found great technical assistance from both this forum and from David Powers and his wonderful books. I am at a crucial point in my web development and although I believe I know which direction I need to go, I am still uncertain and so I appeal to you all for your help, especially David Powers.
    The website I am building is one which will house many photo galleries. I was able to successfully modify the code provided in David Powers’ book ‘php Solutions’ so that I got the photo galleries constructed and working in the manner I desired.
    That being said, a person browsing my website will be presented with a link to see the photo galleries. There will be five (5) categories in which the photos will be separated, all based on specific styles. Now that I have the galleries working, I need to know how to structure things so that I can create a page, like a TOC (table o’ contents) that shows all photo galleries by displaying a thumbnail image or two along with the description. Perhaps I’ll limit the TOC page to only show the latest 25 galleries, arranged with the most current always on top.
    The way I have my galleries set up, I have a separate database for each one, containing the photo filenames and other relevant data. To build my TOC structure, should I have an overall database that contains each gallery database filename along with category? This is where I have no idea what I’m doing so if my question sounds vague, please understand I have no other idea how to ask.
    The site will grow to the point of having hundreds, if not thousands of photo galleries. I simply want to know how to (organize them) or otherwise allow me to build a method to display them in a TOC page or pages.
    I know this is a bit dodgy, but with some info and questions back from you, I feel confident that I should be able to get my point across.
    Lastly, I am still developing this site locally, so I have no links to provide (though I feel that shouldn’t be necessary right now).
    Many sincere thanks to you all in advance,
    wordman

    bregent,
    I'm chewing this over in my head, reading up on DB's in 'phpSolutions' and I think that things are slowly materializing.
    Here is the structure of the website that I have planned:
    MAIN PAGE
    User is presented with a link on the main page to select photo galleries (other links are also present). Clicking the link takes them to the Category Page.
    CATEGORY PAGE
    On this page, the User will then have 5 choices based on categories (photo style). CLicking any of these 5 links will take them to respective TOC pages.
    TOC PAGE
    On this page, the user is greeted with a vertical list of galleries or photosets; one to three thumbs on the left, a small block of descriptive text on the right (ideally containing date/time info to show how recent the gallery is). Newest galleries appear at the top. Eventually, when there are tens or hundreds of galleries in any given catrgory, I'll need to adopt a method for breaking up the qualntity in groups (we can pick 20 for example) that can be scrolled through using a small navbar. This will keep the TOC Pages from getting endlessly long and avoid endless scrolling. User selects a gallery on this page to view.
    THUMBNAIL PAGE
    On choosing a gallery, a thumbnail page is generated (I have this working already)
    IMAGE PAGE
    On selecting any thumbnail in the grid, the user is taken to the full-sized photo with a navbar and photo counter at the top. Navlinks allow forward and back, a link to the first image, a link to the last image and one link back to the thumbnail page. (I have this working already).
    I provide this info in an effort to help understand the basic structure of my site. The description above is as close to a step-by-step illustration as possible.
    Thank you!
    Sincerely,
    wordman

  • Need help with MS SQL server JDBC driver

    Anyone has experience getting ACS working with SQL2005? We keep getting ‘com.adobe.adept.persist.DatabaseException: java.sql.SQLException: No suitable driver’
    We’re using sqljdbc.jar and sqljdbc4.jar that downloaded from Microsoft website. We added this to every library folder under tomcat, JRE and SDK but it did not help. Any suggestion will be helpful.
    Thanks-

    Hi,
    We have ACS with SQL Server 2005 Std correctly working.
    We have this settings:
    ############ SQL Server Connection ############
    com.adobe.adept.persist.sql.driverClass=com.microsoft.sqlserver.jdbc.SQLServerDriver
    com.adobe.adept.persist.sql.connection=jdbc:sqlserver://ip-addressSQL:PortSQL;databaseName =Adept
    com.adobe.adept.persist.sql.dialect=microsoft
    com.adobe.adept.persist.sql.user=userSQL
    com.adobe.adept.persist.sql.password=passSQL
    Wi use Microsoft SQL Server JDBC Driver 3.0 downloaded from Microsoft website (http://www.microsoft.com/download/en/details.aspx?id=21599)
    Good luck,

  • Help with T-SQL query

    I have 3 hierarchical tables. [Parent] ->[Child1]->[Child2]
    I have [Xref] table which stores the documents associated with these three tables. In the [Xref] table, the column “TypeID” defines to which table the document is associated with.
    Below is the table structure with some sample data.
    Question: Given parented I want to get all the documents associated with parent as well its children. My sql query uses Union and its working fine. But Is there any other simple way to re-write this query?
    (Note that this is just an example, the actual hierarchy is pretty long so my SQL is getting little messy and I want simplify it.)
    TYPES
    TypeID TypeName
    1 Parent
    2 Child1
    3 Child2
    TABLE - PARENT
    ParentID
    1
    2
    3
    TABLE - CHILD1
    Child1ID ParentID
    1 1
    2 1
    3 2
    TABLE - CHILD2
    Child2ID Child1ID
    1 1
    2 1
    3 2
    4 2
    XREF
    DocumentID TypeID LocatorID
    1 1 1
    2 1 2
    3 1 3
    4 2 1
    5 2 2
    6 2 3
    7 3 1
    8 3 2
    9 3 3
    10 3 4
    SELECT DocumentID FROM XREF X
    JOIN Parent P ON P.ParentID = x.LocatorID AND TypeID = 1 -- Parent
    WHERE P.ParentID = @ParentID
    UNION
    SELECT DocumentID FROM XREF X
    JOIN Child1 C1 ON C1.Child1ID = x.LocatorID AND TypeID = 2 -- Child1
    JOIN Parent P ON P.ParnetID = C1.ParentID
    WHERE P.ParentID = @ParentID
    UNION
    SELECT DocumentID FROM XREF X
    JOIN Child2 C2 ON C2.Child1ID = x.LocatorID AND TypeID = 3 -- Child2
    JOIN Child1 C1 ON C1.Child1ID = c2.Child1ID
    JOIN Parent P ON P.ParnetID = C1.ParentID
    WHERE P.ParentID = @ParentID

    Can you child span multiple levels? If yes, best way would be to use CTE
    see
    http://technet.microsoft.com/en-us/library/ms186243(v=sql.105).aspx
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Newbie - help with a SQL query for a bar chart  - Originally posted in APEX

    I originally posted this in the APEX forum but someone there suggested this is more of a SQL question.  Anyone out there who can provide some assistance?
    Hi,
    I'm a new user on APEX with no real SQL knowledge and I'm trying to build a dashboard with charts into an existing APEX application. Based on another application, I have come up with the following SQL code:
    select null link
    , CATEGORY label
    , count (decode(PROJECT_STATUS,'1',PROJECT_ID))"Active"
    , count (decode(PROJECT_STATUS,'2',PROJECT_ID))"Complete"
    , count (decode(PROJECT_STATUS,'3',PROJECT_ID))"On Hold"
    , count (decode(PROJECT_STATUS,'4',PROJECT_ID))"Pipeline"
    , count (decode(PROJECT_STATUS,'5',PROJECT_ID))"Pending Review"
    from GRAPO_PROHEADTRK
    where (PROJECT_STATUS='1' or PROJECT_STATUS='2' or PROJECT_STATUS='3' or PROJECT_STATUS='4' or PROJECT_STATUS='5' or PROJECT_STATUS='6')
    group by CATEGORY
    Order by COUNT(PROJECT_ID) DESC
    The code from the other app was:
    select null link
    , FUNCTIONAL_AREA label
    , count (decode(PROJECT_STATUS,'Active',PROJECT_ID))"Active"
    , count (decode(PROJECT_STATUS,'Complete',PROJECT_ID))"Complete"
    , count (decode(PROJECT_STATUS,'On Hold',PROJECT_ID)) "On Hold"
    , count (decode(PROJECT_STATUS,'Recurring',PROJECT_ID))"Recurring"
    , count (decode(PROJECT_STATUS,'Pipeline',PROJECT_ID))"Pipeline"
    , count (decode(PROJECT_STATUS,'Not Approved',PROJECT_ID))"Not Approved"
    from PM_V2
    where LOB='S2S' and (FUNCTIONAL_AREA='Accounts Payable' or FUNCTIONAL_AREA='Expense' or FUNCTIONAL_AREA='Procurement' or FUNCTIONAL_AREA='Fixed Assets')
    group by FUNCTIONAL_AREA
    Order by COUNT(PROJECT_ID) DESC
    I'm getting a "Failed to parse SQL query!" error when I try to run validation.
    Is this enough info for some assistance? Any help would really be appreciated.
    Thanks,
    Rachel

    Hi, Rachel,
    user10774102 wrote:
    I originally posted this in the APEX forum but someone there suggested this is more of a SQL question.  Anyone out there who can provide some assistance?
    Hi,
    I'm a new user on APEX with no real SQL knowledge and I'm trying to build a dashboard with charts into an existing APEX application. Based on another application, I have come up with the following SQL code:
    select null link
    , CATEGORY label
    , count (decode(PROJECT_STATUS,'1',PROJECT_ID))"Active"
    , count (decode(PROJECT_STATUS,'2',PROJECT_ID))"Complete"
    , count (decode(PROJECT_STATUS,'3',PROJECT_ID))"On Hold"
    , count (decode(PROJECT_STATUS,'4',PROJECT_ID))"Pipeline"
    , count (decode(PROJECT_STATUS,'5',PROJECT_ID))"Pending Review"
    from GRAPO_PROHEADTRK
    where (PROJECT_STATUS='1' or PROJECT_STATUS='2' or PROJECT_STATUS='3' or PROJECT_STATUS='4' or PROJECT_STATUS='5' or PROJECT_STATUS='6')
    group by CATEGORY
    Order by COUNT(PROJECT_ID) DESCIs there a problem with the code above?
    It's curious that the WHERE clause includes "PROJECT_STATUS='6'", but there is no pivoted column for project_status='6', like there is for '1' through '5'. That's not necessarily a mistake, and it wouldn't raise an error in any case.
    Instead of
    where (PROJECT_STATUS='1' or PROJECT_STATUS='2' or PROJECT_STATUS='3' or PROJECT_STATUS='4' or PROJECT_STATUS='5' or PROJECT_STATUS='6')you could say
    where PROJECT_STATUS  IN ('1', '2', '3', '4', '5', '6')but that probably has nothing to do with your current problem.
    The code from the other app was:
    select null link
    , FUNCTIONAL_AREA label
    , count (decode(PROJECT_STATUS,'Active',PROJECT_ID))"Active"
    , count (decode(PROJECT_STATUS,'Complete',PROJECT_ID))"Complete"
    , count (decode(PROJECT_STATUS,'On Hold',PROJECT_ID)) "On Hold"
    , count (decode(PROJECT_STATUS,'Recurring',PROJECT_ID))"Recurring"
    , count (decode(PROJECT_STATUS,'Pipeline',PROJECT_ID))"Pipeline"
    , count (decode(PROJECT_STATUS,'Not Approved',PROJECT_ID))"Not Approved"
    from PM_V2
    where LOB='S2S' and (FUNCTIONAL_AREA='Accounts Payable' or FUNCTIONAL_AREA='Expense' or FUNCTIONAL_AREA='Procurement' or FUNCTIONAL_AREA='Fixed Assets')
    group by FUNCTIONAL_AREA
    Order by COUNT(PROJECT_ID) DESC
    I'm getting a "Failed to parse SQL query!" error when I try to run validation.Is that an Apex error message? Sorry, I don't know anything about Apex.
    If you can't get a more specific error message from Apex, then try debugging this statement in SQL*Plus. When you get it fixed, then you can copy it back into Apex.
    If this is a SQL problem, then you should be able to re-create the problem in pure SQL.
    If you can't re-create the problem in pure SQL, then it's probably an Apex problem, and belongs in the Apex forum, not here.
    I don't see anything obviously wrong with your code, but I can't tell if, for example, you spelled a column name wrong, or if something has the wrong data type
    Is this enough info for some assistance? Any help would really be appreciated.It wiould be better if you posted a completE script that people could run to re-create the problem, and to test their ideas.
    Whenever you have a problem, please post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) from all tables involved.
    Also post the results you want from that data, and an explanation of how you get those results from that data, with specific examples.
    Always say which version of Oracle (and any other software, such as Apex) you're using.

  • Newbie - need help with a SQL query for a bar chart

    Hi,
    I'm a new user on APEX with no real SQL knowledge and I'm trying to build a dashboard with charts into an existing APEX application. Based on another application, I have come up with the following SQL code:
    select null link
    , CATEGORY label
    , count (decode(PROJECT_STATUS,'1',PROJECT_ID))"Active"
    , count (decode(PROJECT_STATUS,'2',PROJECT_ID))"Complete"
    , count (decode(PROJECT_STATUS,'3',PROJECT_ID))"On Hold"
    , count (decode(PROJECT_STATUS,'4',PROJECT_ID))"Pipeline"
    , count (decode(PROJECT_STATUS,'5',PROJECT_ID))"Pending Review"
    from GRAPO_PROHEADTRK
    where (PROJECT_STATUS='1' or PROJECT_STATUS='2' or PROJECT_STATUS='3' or PROJECT_STATUS='4' or PROJECT_STATUS='5' or PROJECT_STATUS='6')
    group by CATEGORY
    Order by COUNT(PROJECT_ID) DESC
    The code from the other app was:
    select null link
    , FUNCTIONAL_AREA label
    , count (decode(PROJECT_STATUS,'Active',PROJECT_ID))"Active"
    , count (decode(PROJECT_STATUS,'Complete',PROJECT_ID))"Complete"
    , count (decode(PROJECT_STATUS,'On Hold',PROJECT_ID)) "On Hold"
    , count (decode(PROJECT_STATUS,'Recurring',PROJECT_ID))"Recurring"
    , count (decode(PROJECT_STATUS,'Pipeline',PROJECT_ID))"Pipeline"
    , count (decode(PROJECT_STATUS,'Not Approved',PROJECT_ID))"Not Approved"
    from PM_V2
    where LOB='S2S' and (FUNCTIONAL_AREA='Accounts Payable' or FUNCTIONAL_AREA='Expense' or FUNCTIONAL_AREA='Procurement' or FUNCTIONAL_AREA='Fixed Assets')
    group by FUNCTIONAL_AREA
    Order by COUNT(PROJECT_ID) DESC
    I'm getting a "Failed to parse SQL query!" error when I try to run validation.
    Is this enough info for some assistance? Any help would really be appreciated.
    Thanks,
    Rachel

    Hello,
    This is more of an SQL question, rather than specifically APEX-related. It's notable that you say: I'm a new user on APEX with no real SQL knowledgeWhich is fine (we all have to start somewhere, afterall) but it might be worth de-coupling the problem from APEX in the first instance. I'd also strongly recommend either taking a course, reading a book (e.g. http://books.google.co.uk/books?id=r5vbGgz7TFsC&printsec=frontcover&dq=Mastering+Oracle+SQL&hl=en#v=onepage&q=Mastering%20Oracle%20SQL&f=false) or looking for a basic SQL tutorial - it will save you a whole lot of heartache, I promise you. Search the oracle forums for the terms "Basic SQL Tutorial" and you should come up with a bunch of results.
    Given that you've copied your query template from another, I would suggest ensuring that the actual query works first of all. Try running it in either:
    * SQL Editor
    * SQL*Plus
    * an IDE like SQL Developer (available free from the OTN: http://www.oracle.com/technetwork/developer-tools/sql-developer/downloads/index.html ) or TOAD or similar.
    You may find there are syntax errors associated with the query - it's difficult to tell without looking at your data model.
    select null link
    , CATEGORY label
    , count (decode(PROJECT_STATUS,'1',PROJECT_ID))"Active"
    , count (decode(PROJECT_STATUS,'2',PROJECT_ID))"Complete"
    , count (decode(PROJECT_STATUS,'3',PROJECT_ID))"On Hold"
    , count (decode(PROJECT_STATUS,'4',PROJECT_ID))"Pipeline"
    , count (decode(PROJECT_STATUS,'5',PROJECT_ID))"Pending Review"
    from GRAPO_PROHEADTRK
    where (PROJECT_STATUS='1' or PROJECT_STATUS='2' or PROJECT_STATUS='3' or PROJECT_STATUS='4' or PROJECT_STATUS='5' or PROJECT_STATUS='6')
    group by CATEGORYNote that your "order by" clause references a field called "PROJECT_ID", which exists in the old query but you've changed other similar references to "PROJECT_STATUS" - is it possible you've just missed this one? The perils of copy-paste coding I'm afraid...

  • Power Query for Excel - Need Help with Oracle SQL Syntax

    Hello everyone,
    I am new to Power Query and am not able to figure this out.  I am trying to pull in data into my Excel spreadsheet using a specific Oracle SQL query.  While in query editor, how do I take the Oracle.Database function and add my SQL statement? 
    I already know what I want, I don't want it to download all the table names.  According to the help page, I should be able to do this but it does not provide a syntax example
    Also, I don't understand what "optional options as nullable record" means.
    Below is what function and arguments the help page notes.  How do I use this?
    Oracle.Database(server as text, optional options as nullable record) as table
    Any help is greatly appreciated.
    Thank you,
    Jessica

    When I try this, I get an error 
    DataSource.Error: Oracle: Sql.Database does not support the query option 'Query' with value '"Select * from Owner.View_Name"'. Details: null
    I'm trying to download oracle data from a view into power query - Power Query navigator does not list th eviews from my source, it lists only the tables. When I try write sql statements, it throws me the above
    error. This is what I tried
     Oracle.Database("Source/Service",[Query="Select * from Owner.View_Name"])
    Any ideas how to fix this? 

Maybe you are looking for

  • Help with first java app!

    Hello all. I'm very new to java, and I'm trying to create my first GUI app. The idea behind this app is for the user to enter number of hours worked and the rate of pay, and then it will mutliply them together and give you the result. I have my main

  • Can't sync music on 3rd gen ipod touch

    I recently recieved a new laptop running windows 8.1 and at least three quarters of my music downloads will not sync to my ipod. I keep getting anywhere from file cannot be converted to unknown error has occurred. Yes some of these were downloaded fr

  • Oracle 8.1.7 and Linux 6.2

    Hi Please help us in solving the below mentioned problem. We are trying to install Oracle 8.1.7 under Linux 6.2 . During the installation the following error displays and could not able to finish the instllation. The problem is Error in invoking targ

  • BC4J ApplicationModule - best practice in Stateful web application?

    When writing a stateful web application that uses BC4J framework as the model, what is considered best practice in using the Application Module. Is it okay to store an AM instance in a HttpSession, or should we opt for the features explained in the B

  • Sent emails are duplicated when used Hotmail (IMAP) account

    Hi, by some rason my emails are duplicated when sent out, it is happening on my hotmail acocunt only. Why does it happen? Thanks, Vin