SQL statement Advice Please

Hi - Nice to see the forums back :-)
Ok i have quite a complex question here, but hope some clever
peep can help
me out.
I have a search page with four methods of searching the
database.
The code used on the results page is below.
I've created a three table database - author, department, and
instructions
I've created relationships with these tables using authorID
and DepartmentID
connecting to the instructions table.
So far so good - as you can see from the SQL below.
The problem is that some of the instructions are applicable
to more than one
department and to solve this they have been entered into the
database
several times, but with the relevant DepartmentID.
Now if the user decides to search by author, all of the
instructions are
found including the duplicated ones for each department. i.e.
Authorname1, instruction1, department1
Authorname1, instruction1, department2
Authorname1. instruction1, department3
All i want diaplaying is the one instrcution by that author
and not all for
each department.
Hope this makes some sense!!!
Any idea how to solve this issue?
Thanks in advance - - -
<%
Dim RSresults__MMColParam1
RSresults__MMColParam1 = "0"
If (Request("author") <> "") Then
RSresults__MMColParam1 = Request("author")
End If
%>
<%
Dim RSresults__MMColParam2
RSresults__MMColParam2 = "0"
If (Request("dept") <> "") Then
RSresults__MMColParam2 = Request("dept")
End If
%>
<%
Dim RSresults__MMColParam3
RSresults__MMColParam3 = "0"
If (Request("winumber") <> "") Then
RSresults__MMColParam3 = Request("winumber")
End If
%>
<%
Dim RSresults__MMColParam4
RSresults__MMColParam4 = "0"
If (Request("keywords") <> "") Then
RSresults__MMColParam4 = Request("keywords")
End If
%>
<%
Dim RSresults
Dim RSresults_numRows
Set RSresults = Server.CreateObject("ADODB.Recordset")
RSresults.ActiveConnection = MM_wiConn_STRING
RSresults.Source = "SELECT DISTINCT author.authorID AS
author_authorID,
author.authorname, department.departmentID AS
department_departmentID,
department.departmentname, wi.wiID, wi.wi_no, wi.authorID AS
wi_authorID,
wi.departmentID AS wi_departmentID, wi.work_instruction FROM
department
INNER JOIN (author INNER JOIN wi ON author.[authorID] =
wi.[authorID]) ON
department.[departmentID] = wi.[departmentID] WHERE
authorname = '" +
Replace(RSresults__MMColParam1, "'", "''") + "' OR
departmentname = '" +
Replace(RSresults__MMColParam2, "'", "''") + "' OR wi_no = '"
+
Replace(RSresults__MMColParam3, "'", "''") + "' OR
work_instruction LIKE '%"
+ Replace(RSresults__MMColParam4, "'", "''") + "%' ORDER BY
wi_no ASC"
RSresults.CursorType = 0
RSresults.CursorLocation = 2
RSresults.LockType = 1
RSresults.Open()
RSresults_numRows = 0
%>

Andy,
I'm not sure, but I think you said that you have multiple
entries that
are identical except for the departmentid? Is this the case?
Could you
post your table schema? (which would clear up any questions
about how
you did your setup)
Paul Davis
http://www.kaosweaver.com/
Visit us for dozens of useful Dreamweaver Extensions.
http://www.communitymx.com/
Partner at Community MX - Extend your knowledge
Andy wrote:
> Hi - Nice to see the forums back :-)
> Ok i have quite a complex question here, but hope some
clever peep can help
> me out.
> I have a search page with four methods of searching the
database.
> The code used on the results page is below.
>
> I've created a three table database - author,
department, and instructions
> I've created relationships with these tables using
authorID and DepartmentID
> connecting to the instructions table.
> So far so good - as you can see from the SQL below.
>
> The problem is that some of the instructions are
applicable to more than one
> department and to solve this they have been entered into
the database
> several times, but with the relevant DepartmentID.
> Now if the user decides to search by author, all of the
instructions are
> found including the duplicated ones for each department.
i.e.
>
> Authorname1, instruction1, department1
> Authorname1, instruction1, department2
> Authorname1. instruction1, department3
>
> All i want diaplaying is the one instrcution by that
author and not all for
> each department.
>
> Hope this makes some sense!!!
>
> Any idea how to solve this issue?
>
> Thanks in advance - - -
>
>
> <%
> Dim RSresults__MMColParam1
> RSresults__MMColParam1 = "0"
> If (Request("author") <> "") Then
> RSresults__MMColParam1 = Request("author")
> End If
> %>
> <%
> Dim RSresults__MMColParam2
> RSresults__MMColParam2 = "0"
> If (Request("dept") <> "") Then
> RSresults__MMColParam2 = Request("dept")
> End If
> %>
> <%
> Dim RSresults__MMColParam3
> RSresults__MMColParam3 = "0"
> If (Request("winumber") <> "") Then
> RSresults__MMColParam3 = Request("winumber")
> End If
> %>
> <%
> Dim RSresults__MMColParam4
> RSresults__MMColParam4 = "0"
> If (Request("keywords") <> "") Then
> RSresults__MMColParam4 = Request("keywords")
> End If
> %>
> <%
> Dim RSresults
> Dim RSresults_numRows
>
> Set RSresults = Server.CreateObject("ADODB.Recordset")
> RSresults.ActiveConnection = MM_wiConn_STRING
> RSresults.Source = "SELECT DISTINCT author.authorID AS
author_authorID,
> author.authorname, department.departmentID AS
department_departmentID,
> department.departmentname, wi.wiID, wi.wi_no,
wi.authorID AS wi_authorID,
> wi.departmentID AS wi_departmentID, wi.work_instruction
FROM department
> INNER JOIN (author INNER JOIN wi ON author.[authorID] =
wi.[authorID]) ON
> department.[departmentID] = wi.[departmentID] WHERE
authorname = '" +
> Replace(RSresults__MMColParam1, "'", "''") + "' OR
departmentname = '" +
> Replace(RSresults__MMColParam2, "'", "''") + "' OR wi_no
= '" +
> Replace(RSresults__MMColParam3, "'", "''") + "' OR
work_instruction LIKE '%"
> + Replace(RSresults__MMColParam4, "'", "''") + "%' ORDER
BY wi_no ASC"
> RSresults.CursorType = 0
> RSresults.CursorLocation = 2
> RSresults.LockType = 1
> RSresults.Open()
>
> RSresults_numRows = 0
> %>
>
>

Similar Messages

  • How to create a database using a SQL statement? Please help.

    Connection con = DriverManager.getConnection("jdbc:oracle:thin:@192.168.0.25:1521:mydb","system","12345678");
    but mydb database does not exist.
    I want to make a connection to oracle server without database name.
    How can I do?

    Colleauge, what is the purpose of making a connection to a non-existent database.
    connections are made to the database to retrieve some data or put some data.
    for which the database should exists.
    so please create the mydb database first using Database Configuration Assistant (DBCA) which is much easier as it is GUI based rather than doing it with sql scripts.

  • Pass parameter to sql statement in query manager

    Hai to all,
               I want to pass the percentage  as the parameter into the sql statemnet.i what to execute it in the query manager.
              If i execute that statement then cann't found the tablename error is coming.
             Other than the data in the table (general data)  pass to the parameter in the sql at runtime.
    for example:
    select [%0] *100
    how to pass 10 to that sql statement.
    Please help me...
    Regards,
    Raji.

    Hi Ramya,
    You can create a SP with parameters to accept and then execut this SP from SAP Business One Query Manager by passing the parameter (in your case 10). The result will be as desired.
    Ex:
    Create this Procedure in SQL Management Studio
    create proc Test(@a as int)
    as
    begin
    select (@a*100)
    end
    To Execute the Query use this Query and pass the desired values with parameters
    execute Test 10
    Regards,
    Reno

  • Using sql function in xml sql statement

    Hello,
    I have following statement:
    select field1, field2,....,field10 from table( cast (get_mhdata(:1,:2) as mhdata))
    where mhdata is an oracle type with 10 fields.
    It works good, but I don't know how can I use this statement in xml sql statement.
    Please, can you tell me if it is really possible.
    Thanks in regards.

    Hi
    You cant pass the parameters if you are executing writing this select function from the communication channel.
    You have 3 options:
    1) Use a stored procedure and execute from the communication channel
    2) Use a stored procedure and execute via message mapping in the IR - here you can pass parameters
    3) Same as above but call the query via SQL select - you can also pass parameters.
    sincerely,
    --NM

  • Is it that we cannot run sql statement in main??

    Hi all,
    sorry to bother again. But i have some problems. I had a program that have main method and some other small methods that contains some sql statement that call the db to retrieve info. But it keep on prompting me error: "Connection refused. Check that the hostname and port is correct, and that the postmaster is running with the -i flag, which enables TCP/IP networking.".
    My program reside in the server but i really don't why i cannot run it. Is it because the main program cannot run with database and sql statement.
    Please reply asap. Thank You!

    This sound very much that your postgress isn't running (or if it isn't it wasn't started with the -i flag)
    Are you sure postgres (=postmaster) is running
    Thomas

  • Why DECODE can only be used in sql statement

    Hi,
    Why the sql1 works but sql2 doesn't.
    sql 1 ) Select decode(1,0,0,1) into var from dual;
    sql 2 ) var = decode(1,0,0,1);
    Kindly clarify.
    Regards,
    Kishore

    Hi Purvesh,
    2nd works fine for 11g onwards.
    Really?
    Got the same error when executed the below (on Oracle 11.2.0.3.0)
    SQL> DECLARE
      2    var_x NUMBER := 1;
      3    var_y VARCHAR2(10);
      4  BEGIN
      5    var_y := Decode(var_x, 1, 'Yes', 'No');
      6    Dbms_Output.PUT_LINE('var_x: '||var_x);
      7    Dbms_Output.PUT_LINE('var_y: '||var_y);
      8  END;
      9  /
      var_y := Decode(var_x, 1, 'Yes', 'No');
    ERROR at line 5:
    ORA-06550: line 5, column 12:
    PLS-00204: function or pseudo-column 'DECODE' may be used inside a SQL
    statement only
    ORA-06550: line 5, column 3:
    PL/SQL: Statement ignored
    Please explain me the same.

  • SQL STATEMENT JDBC

    I am trying to modify column size to Access. If str has 23 char and md(from Access with JDBC) has 20 char, then it must change 20 char to 23 char because I want to expand more chars.
    if(md.getColumnDisplaySize(j) < Integer.parseInt(str))
    st.executeUpdate("alter table IKB modify ( Firstname char (" + str[i] +"))");
    I got this:java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error in ALTER TABLE statement. I mean I checked sql sites to make sure that I am not doing with wrong sql statement. Please Tell me what I did wrong.
    Thank you

    Hi,
    sorry to bother you with a question but you're obviously more advanced than I am with Java.
    I'm trying to do a simple insert statement in Java but it doesn't work:
    rec2 = st2.executeQuery("INSERT INTO chequetable VALUES ('1', '2', '3', '4', '5', 94, '6', '7', '8', '9');");
    my record has 10 fields all being a string except for field 6.
    When I run this I get a SQL Error 0 S1000
    Have you got an example of a simple SQL insert statement through Java.
    Incidentally, I've been playing with Swing quite extensively so if you have any questions on that subject I'd be happy to help.
    M.A.D

  • Is there a way to excute a Native SQL statements simply?

    I heard that there is a standard transaction code to test a Native SQL statement.
    Please let me know if you are know that.
    Thank you!

    hi,
    Try this in SE38.
    data: itab type mara-matnr.
    exec sql performing a1.
    select matnr from mara into :itab
    endexec.
    form a1.
    write:/ itab.
    endform.
    Note: The sql stmt with in exec sql  and endexec
    'll not be checked.
    Thanks.
    Arunprasad.P

  • Single select query or any sql statement with o/p

    Hi,
    I have one table test_tab with column names empno,empname.The test_tab values is as follows,
    empno empname
    01 siva
    02 ram
    03 kamal
    04 sathish
    i will give the empname values like 'siva,kamal,roshan,sathish' and empno >03,but in the table roshan name is not there.I need the below mentioned o/p
    example qry: select empno,empname from test_tab where empname in('siva','kamal','roshan','sathish') and empno>03;
    my o/p should be like this,
    empname empno
    sathish 04
    roshan ''
    But the empname 'roshan' is not there in table.I need the empname as 'roshan' and empno is null value in a single select query or subquery or any sql statements.
    Please help me the resolve this issue.
    Thanks
    Sivaraman

    Hi,
    Do you want this?
    with data as
    (select 1 EMPNO, 'siva' as empname from  DUAL union all
    select 2 EMPNO, 'ram' from  DUAL union all
    select 3 EMPNO, 'kamal' from  DUAL union all
    select 4 EMPNO, 'sathish' from  DUAL union all
    select null EMPNO, 'roshan' from  DUAL )
    select *  from data
    where EMPNAME in ('siva','kamal','roshan','sathish')
       and nvl2(empno,empno,4) > 3 

  • Calling SQL statements from Shell scripts

    Hi,
    I want to call external package procedures, declare some variables & do some oracle validations in the shell script.
    How SQL environment is set in shell script & is this one time process or I have to write few statements before every SQL statement.
    Please explain with an example.
    Thanks..

    is this one time process Yes. Example :
    $ cat script.sh
    export ORACLE_HOME=/home/oracle/base/OraHome10
    export ORACLE_SID=db102
    export PATH=$ORACLE_HOME/bin:$PATH
    sqlplus -s / as sysdba << EOF
    select to_char(sysdate,'dd/mm/yyyy hh24:mi:ss') date_time
    from dual;
    exit
    EOF
    sqlplus -s / as sysdba << EOF
    col global_name for a60
    select * from global_name;
    exit
    EOF
    $ ./script.sh
    DATE_TIME
    27/02/2008 11:11:27
    GLOBAL_NAME
    DB102
    $

  • Please tell me the  Three table INNER JOIN Sql statement

    Hi experts,
      I got requirement like by using INNER JOIN i have to write the code in MY program i.e using 3 tables VBAK VBAP and VBUK.And the common field is VBELN .SO please give the  INNER JOIN SQL statement for above three tables...
    vbak-vbeln,erdat
    vbap-vbeln,posnr
    vbuk-vbeln,RFSTK
    Thanks in Advance

    hi guglani  please see my total code b.caus DATA is not extracting...once see the code  correct error.
    DATA:V_VBELN TYPE VBAK-VBELN.      "VBAK,VBAP AND VBUK
    SELECT-OPTIONS SORDER FOR V_VBELN.
    TYPES:BEGIN OF T_VBAK,
         VBELN TYPE VBELN_VA,
         ERDAT TYPE ERDAT,
      END OF T_VBAK.
    TYPES:BEGIN OF T_VBAP,
           VBELN TYPE VBELN_VA,
            POSNR TYPE POSNR_VA,
      END OF T_VBAP.
    TYPES:BEGIN OF T_VBUK,
        VBELN TYPE VBELN,
      RFSTK TYPE RFSTK,
      END OF T_VBUK.
    TYPES:BEGIN OF FS,
       VBELN TYPE VBELN_VA,
         ERDAT TYPE ERDAT,
    POSNR TYPE POSNR_VA,
      RFSTK TYPE RFSTK,
      END OF FS.
    DATA:WA1 TYPE T_VBAK,
         WA2 TYPE T_VBAP,
         WA3 TYPE T_VBUK,
         WA TYPE FS.
    DATA:ITAB1 TYPE TABLE OF T_VBAK,
          ITAB2 TYPE TABLE OF T_VBAP,
          ITAB3 TYPE TABLE OF T_VBUK,
          ITAB TYPE TABLE OF FS.
    select a~vbeln a~erdat b~posnr c~rfstk
           from vbak as a inner join vbAP as b on a~vbeln = b~vbeln
                          inner join vbuk as c on a~vbeln = c~vbeln
    into table itab
    where A~vbeln eq SORDER.
    IF NOT ITAB IS INITIAL.
      SORT ITAB BY VBELN.
    ENDIF.
    LOOP AT ITAB INTO WA.
       WRITE:/ WA-VBELN,WA-ERDAT,WA-rfstk.
       ENDLOOP.
       CLEAR WA.
       REFRESH ITAB.

  • APP-ALR-04106: Please correct the user-defined SQL statement for this alert

    Hi All,
    I have created an alert for engineering module in R12. It got tested and was working fine. when the user testing it, while trigger the alert getting the error, "APP-ALR-04106: Please correct the user-defined SQL statement for this alert".
    when verified the alert, it got verified and ran also. It parsed the query successfully and when run it fetched few records.
    Need help in resolving the issue.
    Thanks in advance.
    Regards,
    sri
    Edited by: user10939296 on Jan 18, 2010 1:16 AM

    Hi Sri;
    I have already gone through the Note: 948037.1. But this note is related to 11i. The solution provided in the Note is for 11i.
    I am facing this issue in R12. Is this patch applicable to R12?I belive its not. But u can check Solution part 4 for your instance, at least it can give you idea. The other note in metalink related bug and all for R11 too.
    I belive its better way to rise Sr while waiting other forum user response to that thread
    Regard
    Helios

  • SQL STATEMENT , PLEASE HELP

    Hi,
    I want some help in writing a SQL Query .Its besically a hierarchical query. Let me lay down the table structure first to explain my requirements better.
    PORP_TABLE(NODE_LEVEL int, WBS_ID int, WBS_NUMBER varchar(60), LFT int,RGT int)
    SELECT NODE_LEVEL, WBS_ID, LFT,RGT FROM PROPOSAL_WBS PW WHERE PROPOSAL_REV_ID = 7000
    (SAMPLE DATA)
    NODE WBS
    LEVEL WBS_ID NUMBER LFT RGT
    0 7055 ROOT 1 24
    1 7056 1 2 5
    1 7088 2 6 9
    2 7057 1.1 3 4
    2 7089 2.1 7 8
    2 7091 3.1 11 14
    2 7103 3.2 15 16
    2 7105 4.1 19 20
    1 7090 3 10 17
    3 7092 3.1.1 12 13
    1 7104 4 18 23
    2 7106 4.2 21 22
    ALLOCATION_DETAIL( WBS_ID int, COST_ID int, PERIOD Date, AMOUNT Float)
    sample data
    WBS_ID , COST_ID , PERIOD , AMOUNT
    7057 100 01-jan-2005 5000
    7057 100 01-feb-2005 2000
    7057 100 01-mar-2005 1000
    7057 100 01-apr-2005 6000
    7057 100 01-may-2005 3000
    7057 100 01-jun-2005 45000
    7106 100 01-mar-2005 8000
    7106 100 01-apr-2005 7000
    7106 100 01-may-2005 9000
    Now the PORP_TABLE has got the parents and childs. Only the leaf nodes in the hierarchy has the values stored in the ALLOCATION_DETAIL table. Now here is the scenario
    In the example 7055 is the root WBS . The Leaf WBS are the one with max extension in the wbs number ( in this case it is 1.1, 2.1, 3.1.1, 3.2, 4.1 and 4.2)
    Now the Starting period for each leaf node in the ALLOCATION_TABLE could be differrent . What that means is WBS 1.1 could start in Jan -2003 and WBS 3.1 Could be Jul-2005 . So the ending perios are also differrent for differrent WBS . Some can span 2 years some can 5 years.
    So how to write a query so it retrieves the value for all the Wbs starting from the MIN ( PERIOD ) upto the MAX(PERIOD), and it should roll up also. Now there is No connect by Prior or any analytic functions available for this . THIS NEEDS TO BE DONE ONLY THROUGH TRADITIONAL SQL STATEMENT . And NO DB FUNCTIONS CAN BE USED .
    Now if the WBS is a parent node then it should have the sum of all its child nodes for the COST category.
    SO THE RESULT SET SHOULD BRING LIKE THIS
    WBS_NUMBER, PERIOD_NUMER, COST_CATEGORY , AMOUNT
    ROOT
    1
    1.1
    2
    2.1
    3
    3.1
    3.1.1
    3.2
    4
    4.1
    4.2
    ......

    Thanks for all your thoughtfull replies and feedbacks. Yes it is in Sybase platform . Though I have been woking all along in Oracle , Unfortunately this one is in Sybase, and no the customer cant and wont move to Oracle. So I have to work with it . And if you want to see the table structure . Here are they :
    CREATE TABLE PROPOSAL_WBS (
    BURDEN_CENTER_ID      numeric(18,0) NULL,
    START_DATE      datetime NULL,
    END_DATE      datetime NULL,
    WBS_ID      int NOT NULL,
    MODIFIED_DATE      datetime NULL,
    CREATED_DATE      datetime NULL,
    MODIFIED_BY      varchar(127) NULL,
    CREATED_BY      varchar(127) NULL,
    FEE_PERCENT      float NULL,
    PROPOSAL_REV_ID      int NOT NULL,
    PARENT_WBS_ID      int NULL,
    NAME      varchar(127) NULL,
    COMMENT      varchar(255) NULL,
    TARGET_COST      float NULL,
    MONTHS_REMAINING      int NULL,
    DEFAULT_STAFF_FTE      float NULL,
    ANNUAL_GRA_SALARY      float NULL,
    NUMBER_OF_GRA      int NULL,
    MANAGEMENT_ADJUSTMENT_TOTAL     float NULL,
    MA_UNALLOCATED_FUNDS      float NULL,
    FEE_TOTAL      float NULL,
    FEE_UNALLOCATED_FUNDS      float NULL,
    TRAVEL_COMMENTS      varchar(255) NULL,
    ODC_COMMENTS      varchar(255) NULL,
    SORT_ORDER      int NULL,
    LFT      int NULL,
    RGT      int NULL,
    NODE_LEVEL      int NULL,
    WBS_NUMBER      varchar(50) NOT NULL,
    TOTAL_COST      float NULL,
    TOTAL_COST_PLUS_FEE      float NULL,
    PER_MILE_COST      float NULL,
    PER_DIEM      float NULL,
    TAX_RATE      float NULL,
    RENTAL_CAR_PER_DAY_COST      float NULL,
    TAXI_PER_TRIP_COST      float NULL,
    CONSTRAINT PK_PROPOSAL_WBS PRIMARY KEY(WBS_ID)
    CREATE TABLE PROPOSAL_WBS_ALLOC_DETAIL (
    WBS_ID      int NOT NULL,
    OBJECT_CODE_ID      numeric(18,0) NOT NULL,
    PERIOD_NUMBER      int NOT NULL,
    ALLOCATION_AMOUNT     float NULL,
    PERIOD_YEAR      datetime NULL,
    CONSTRAINT PK_PROPOSAL_WBS_AD PRIMARY KEY(WBS_ID,OBJECT_CODE_ID,PERIOD_NUMBER)
    CREATE TABLE WBS_PERIOD (
    PERIOD_NUMBER     int NOT NULL
    CREATE VIEW WBS_COST_CAT AS
    SELECT PROPOSAL_WBS.PROPOSAL_REV_ID,
    PROPOSAL_WBS.WBS_ID,
    PROPOSAL_WBS.NAME, PROPOSAL_WBS.SORT_ORDER,
    PROPOSAL_WBS.NODE_LEVEL, PROPOSAL_WBS.WBS_NUMBER,
    CODES.CODE_ID COST_CATEGORY, CODES.CODE_NAME COST_CAT_NAME
    FROM PROPOSAL_WBS, CODES
    CREATE TABLE CODES (
    CODE_ID      numeric(18,0) NOT NULL,
    CODE_VALUE      varchar(254) NULL,
    CODE_NAME      varchar(254) NULL,
    CODE_TYPE      numeric(18,0) NULL,
    CODE_PARENT_ID     numeric(18,0) NULL,
    CONSTRAINT PK_CODE_ID PRIMARY KEY(CODE_ID)
    So let me explain little bit more . The WBSs are categorized into two differrent types. One as INPUT and the second one as NON INPUT. Now assme the the WBS in a tree structure . So only the LEAF WBSs will have the AMOUNT and they are the INPUT WBSs and all non leaf WBSs are NON INPUT. Now lets say there are 5 LEAF WBSs. Each LEAF WBS will have differrent start period ex: WBS 1.1 starts in January 2003 and goes for 48 periods . WBS 2.1 starts in November 2003 and goes for 35 periods . WBS 3.1 starts in March 2004 and goes for 52 periods. and so on .
    Now as there is no Allocation Amount entry for all other WBSs except the LEAF WBSs. So how do I get the roll up . For example if you imagine the parent of WBS 1.1 is WBS 1 , and the parent of WBS 2.1 is WBS 2 and the Parent of WBS 3.1 is WBS 3 , and the parent for WBS 1, WBS 2, WBS 3 is "ROOT WBS". As I said there is no entry for WBS 1, WBS 2 , WBS 3 and the "ROOT WBS". So how do I have a roll up of the Leaf WBS data for their parent WBSs.
    Now if u think of the data in a matrix report, the WBSs and the COST CATEGORY will be the row values, the Period Numbers will the column values and the Allocation Amount will be the cross values. so lets say the WBS 1 has got two leaf nodes, WBS 1.1 and WBS 1.2 then WBS 1 will have the summed amount for each period starting the minumum period of the two of its leaf nodes and for all the cost categories of both the leaf nodes. and the "ROOT WBS" will have all the cost categories of al the Leaf nodes . for all the periods , period wise.

  • Problem in Calling a function in sql statement.

    hi,
    I am having a function ops_safex_utl.EDIT_ASSC_CNTR_LOG(id number);
    when i am trying to use this inside a sql statement as shown below, it is giving error (exception part inside the function).
    SQL> select ops_safex_utl.EDIT_ASSC_CNTR_LOG(688) from dual;
    OPS_SAFEX_UTL.EDIT_ASSC_CNTR_LOG(688)
    -1 (-- exception )
    when i am trying to call this function using a PL/SQL Block then it is woking fine as shown below.
    SQL> DECLARE
    2
    3 x NUMBER(2);
    4
    5 BEGIN
    6
    7 x := ops_safex_utl.EDIT_ASSC_CNTR_LOG(688);
    8
    9 dbms_output.put_line('x '||' '||x);
    10
    11 END;
    12 /
    hi
    insert into ops_assc_cntr_log
    insert into ops_ac_ex_gratia_log
    insert into ops_ac_sls_dlvry_slab_dtls_log
    insert into ops_ac_sls_dlvry_slab_dtls_log
    insert into ops_ac_sls_dlvry_slab_dtls_log
    insert into ops_ac_sls_dlvry_slab_dtls_log
    insert into ops_ac_sls_dlvry_slab_dtls_log
    insert into ops_ac_spl_acct_dtls_log
    insert into ops_ac_spl_acct_slab_dtls_log
    insert into ops_ac_spl_acct_slab_dtls_log
    insert into ops_ac_spl_acct_slab_dtls_log
    insert into ops_ac_spl_acct_dtls_log
    insert into ops_ac_spl_acct_slab_dtls_log
    insert into ops_ac_spl_acct_slab_dtls_log
    insert into ops_ac_spl_acct_slab_dtls_log
    update ops_assc_cntr
    success
    x 0
    PL/SQL procedure successfully completed.
    when i am trying to run the SQL statement it is returning a exception from the function.
    SELECT ops_safex_utl.EDIT_ASSC_CNTR_LOG(688) from dual --it is returning -1 (i.e exception).
    My sql client version is 9.2.0.1.0. and my data base version is 10.2.0.2.0.
    Please advice.

    Could you post the exception handler within the function.
    It sounds like you return -1 if you experience an error - it would be easier to determine the cause of the problem if you return the Oracle error details, E.g:
    EXCEPTION
       WHEN OTHERS THEN
          RETURN dbms_utility.format_error_backtrace;This will then return a meaningful error, identifying exactly what is causing the error to be generated.

  • Run sql statement in green screen

    dear as/400 guru,
    i wonder how to execute sql statement in green screen ?
    my statement would be something as below
    select mandt from sapr3.usr02 where bname='kent';
    basically i want to check my id "kent" is available in which clients in an instance. and i was advised to run above sql statement.
    comment and advice will be highly appreciated.
    thanks
    regards,
    kent
    as/400 newbie

    Hi Kent,
    if you are looking for something, that reminds the old SQLs and uses a "/" for the delimiter, get the free STR(CON)SQL tool :
    http://www.easymarketplace.de/strsql-sqlutil.php
    If you do not receive a mail within 15 minutes, please drop me a mail, I will then reply with the user & pwd ...
    Regards
    Volker Gueldenpfennig, consolut international ag
    http://www.consolut.de - http://www.4soi.de - http://www.easymarketplace.de

Maybe you are looking for

  • A minimum ADOBE service setup

    Hi! We want to use our existing servers/systems to provide an ADOBE environment for developers. We have 1) an ECC6 (ABAP only) 2) an EP7 (JAVA only) Our plan is to 1) configure ADS on the EP7 (JAVA only) 2) create RFC on the ECC6 (ABAP only) Question

  • Error - when a report is scheduled in WebI - "this"

    Hi, I have a very complex report which connects to BEX query and have complex contexts and many variables to satisfy the requirement. Firstly to run the report it takes a long time as the Cobra fails due to the heap size even when the size is increas

  • Creating multipage report using XSL

    Hi Here is one requirement in our project, where we have multiple purchase order in XML file, each of the purchase order may contains n number of lines. We have to create the PO report using the XSL-FO method. If any purchase order printed on n no. o

  • Missing files and other issues

    Hello everyone, We are in the process of performance testing a 2 piece workflow where a fax server places the received fax into a watched folder endpoint, a process picks it up separates the pages and pushes the single pages to another process for va

  • Windowsupdate says windowsupdate is not running (0xc8000247)

    Friend of mine has "Windows 7 x64 Prof" and windowsupdate says Log says : 2011-09-06    19:14:12:578     996    ab8    Agent    ************* 2011-09-06    19:14:12:578     996    ab8    Agent    ** START **  Agent: Installing updates [CallerId = Aut