SQL on CUIC help please!?

Hi Everyone.
We have recently had the outbound option put in and shortly identified a bug which was reported to Cisco (CSCud29354) which makes real time monitoring of abandoned rates very difficult.
My SQL is very limited but I managed to write 2 queries, one that would give me the amount of connected calls by campaign and one that would give me the amount of abandoned calls by campaign.
I got in touch with the company that implemented the system and asked them to combine the 2 queries and add a formula for working out the abandon rate. Whilst they couldn't give me something that was tested on CUIC they sent me the below which gives an error of:
"Create the parameters or correct the query syntax and  recreate the parameters. Incorrect syntax near ' '
If someone could help that would be great as I can't get my head around how the query works - below is what I was sent from the company:
As you know, the solution requires the merging of the 2 queries.  The method used below is to embed the Abandoned call count query by CampaignName into a nested select or aka sub-query. The sub-query references back to the CampaignName to ensure it is fetching the count required for the CampaignName only. This is achieved via the names results sets X and Y.
I’ve also included the syntax for calculating the Drop rate based on the retrieved values per CampaignName.
There may be some tweaks required that are relevant to your appropriate SQL engine but the below should provide a good starting point.
SELECT  CampaignName,
SUM(Connected) AS Conn, (
SELECT SUM(Abandoned) AS ABD
FROM
SELECT CampaignName, DateTime, COUNT(CallResult) as "Abandoned"
FROM Dialer_Detail(nolock), Campaign
WHERE Dialer_Detail.CampaignID = Campaign.CampaignID AND
CampaignName = Y.CampaignName
AND CallGUID IS NOT NULL
AND CallResult = 20
GROUP BY CampaignName, DateTime
UNION ALL
SELECT CampaignName, DateTime, COUNT(CallResult) as "Abandoned"
FROM Dialer_Detail(nolock), Campaign
WHERE Dialer_Detail.CampaignID = Campaign.CampaignID AND
CampaignName = Y.CampaignName
AND CallGUID IS NOT NULL
AND CallResult = 16
GROUP BY CampaignName, DateTime
) X
WHERE DateTime >= :StartDate
And DateTime <= :EndDate
And X.CampaignName = Y.CampaignName
GROUP BY  CampaignName
WITH ROLLUP) AS ABD2,
((ABD2/Conn)*100) as “Drop Rate”
FROM
SELECT CampaignName, DateTime, COUNT(CallResult) as "Connected"
FROM Dialer_Detail(nolock), Campaign
WHERE Dialer_Detail.CampaignID = Campaign.CampaignID
AND CallGUID IS NOT NULL
AND CallResult = 20
GROUP BY CampaignName, DateTime
UNION
SELECT CampaignName, DateTime, COUNT(CallResult) as "Connected"
FROM Dialer_Detail(nolock), Campaign
WHERE Dialer_Detail.CampaignID = Campaign.CampaignID
AND CallGUID IS NOT NULL
AND CallResult = 16
GROUP BY CampaignName, DateTime
UNION
SELECT CampaignName, DateTime, COUNT(CallResult) as "Connected"
FROM Dialer_Detail(nolock), Campaign
WHERE Dialer_Detail.CampaignID = Campaign.CampaignID
AND CallGUID IS NOT NULL
AND CallResult = 10
GROUP BY CampaignName, DateTime
UNION
SELECT CampaignName, DateTime, COUNT(CallResult) as "Connected"
FROM Dialer_Detail(nolock), Campaign
WHERE Dialer_Detail.CampaignID = Campaign.CampaignID
AND CallGUID IS NOT NULL
AND CallResult = 14
GROUP BY CampaignName, DateTime
UNION
SELECT CampaignName, DateTime, COUNT(CallResult) as "Connected"
FROM Dialer_Detail(nolock), Campaign
WHERE Dialer_Detail.CampaignID = Campaign.CampaignID
AND CallGUID IS NOT NULL
AND CallResult = 21
GROUP BY CampaignName, DateTime
UNION
SELECT CampaignName, DateTime, COUNT(CallResult) as "Connected"
FROM Dialer_Detail(nolock), Campaign
WHERE Dialer_Detail.CampaignID = Campaign.CampaignID
AND CallGUID IS NOT NULL
AND CallResult = 23
GROUP BY CampaignName, DateTime
UNION
SELECT CampaignName, DateTime, COUNT(CallResult) as "Connected"
FROM Dialer_Detail(nolock), Campaign
WHERE Dialer_Detail.CampaignID = Campaign.CampaignID
AND CallGUID IS NOT NULL
AND CallResult = 24
GROUP BY CampaignName, DateTime
) Y
WHERE DateTime >= :StartDate
And DateTime <= :EndDate
GROUP BY  CampaignName
WITH ROLLUP
Thanks a lot
Russell Healey

Sometimes, the most obvious things are the harder to see...
The correct is 'order by', not 'order_by'!

Similar Messages

  • SQL INSERT problem - help please

    Hello,
    I'm having a problem with INSERT statement.
    There is a "ShowFinal.jsp" page, which is a list of candidates who selected from the second
    interview. The user picked some candidates from the list and conduct the 3rd interview. After
    he check suitable candidates(who are selected from the 3rd interview) from the list , enter
    basic salary for every selected candidate, enter date of interview and finally submit the form.
    These data should be save into these tables.
    FinalSelect(nicNo,date)
    EmpSalary(nicNo,basicSal)
    In this "ShowFinal.jsp" page, it validates the following conditions using JavaScript.
    1) If the user submit the form without checking at least one checkbox, then the system should be
    display an alert message ("Please select at least one candidate").
    2) If the user submit the form without entering the basic salary of that candidate which was
    checked, then the system should be display an alert message ("Please enter basic salary").
    These are working well. But my problem is how to wrote the "AddNewFinal.jsp" page to save these
    data into the db.
    Here is my code which I have wrote. But it points an error.
    "AddNewFinal.jsp"
    String interviewDate = request.getParameter("date");
    String[] value = request.getParameterValues("ChkNicno");
    String[] bs = request.getParameterValues("basicSal");
    String sql ="INSERT INTO finalselect (nicNo,date) VALUES(?,?)";
    String sql2 ="INSERT INTO EmpSalary (nicNo,basicSal) VALUES(?,?)";
    for(int i=0; i < value.length; i++){
         String temp = value;     
         for(int x=0; x < bs.length; x++){
              String basic = bs[x];
              pstmt2 = connection.prepareStatement(sql2);
              pstmt2.setString(1, temp);
              pstmt2.setString(2, basic);
              int RowCount1= pstmt2.executeUpdate();
         pstmt1 = connection.prepareStatement(sql);
         pstmt1.setString(1, temp);
         pstmt1.setString(2, interviewDate);
         int RowCount= pstmt1.executeUpdate();
    Here is the code for "ShowFinal.jsp".
    <form name="ShowFinal" method="POST" action="AddNewFinal.jsp" onsubmit="return checkEmpty() &&
    ValidateDate();">
    <%--  Loop through the list and print each item --%>
    <%
         int iCounter = 0; //counter for incremental value
         while (igroups.hasNext()) {
              Selection s = (Selection) igroups.next();
              iCounter+=1; //increment
    %>
    <tr>
         <td style="background-color:ivory" noWrap width="20">
         <input type="checkbox" name="<%= "ChkNicno" + iCounter %>"      
    value="<%=s.getNicno()%>"></td>
            <td style="background-color:ivory" noWrap width="39">
                 <%= s.getNicno() %>  </td>
         <td style="background-color:ivory" noWrap width="174">
              <input type="text" name="<%= "basicSal" + iCounter %>" size="10"> </td>
    </tr>
    <%
    %>
    Date of interview<input type="text" name="date" size="17"></td>
    <input type="submit" value="APPROVE CANDIDATE" name="B1" style="border: 1px solid #0000FF">
    </form>........................................................
    Here is the error generated by TOMCAT.
    root cause
    java.lang.NullPointerException
         at org.apache.jsp.AddNewFinal_jsp._jspService(AddNewFinal_jsp.java:70)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
    I have goto the file "AddNewFinal_jsp.java". The line 70 points to the following line.
    for(int i=0; i < value.length; i++){ [/b]
    Please can someone help me to solve this problem? Please help me to do this task.
    Thanks.

    Hi Casabianca ,
    It is clearly that your problem is not on the database end, more like a servlet/jsp issue.
    I will not comment on the javascript portion, but rather the 2 jsps.
    a simple way to trace what's go wrong is to check the final result (the html code) of the first jsp (showFinal.jsp), and compare against what is expected by the 2nd jsp (AddNewFinal.jsp). Most browser do provide "view source" on the page visited.
    the following code
    <input type="checkbox" name="<%= "ChkNicno" + iCounter %>" value="<%=s.getNicno() %>">
    <input type="text" name="<%= "basicSal" + iCounter %>"
    would likely to be "translated" to html code something as follow:
    <input type="checkbox" name=""ChkNicno0" value="nicNo>">
    <input type="text" name="basicSal0">
    the original code in "AddNewFinal.jsp" using
    request.getParameterValues("ChkNicno");
    which looking for a none exist http request parameter (sent as "ChkNicno0",etc but look for "ChkNicno"), which has explained before.
    the second attempt to use String[] value = request.getParameterValues("ChkNicno" + iCounter); give Cannot resolove symbol :iCounter. because iCounter never defined in the 2nd jsp!
    Most of the error message do give clue to cause of error... : )
    not too sure on your intension, assume you wish to update only those selected (checked) row to db.
    some suggestions:
    1) <input type="text" name="ChkNicno" size="10"> </td>...
    <input type="text" name="basicSal" size="10"> instead.
    then use javascript to based on checked element index (refer to javascript spec for more details), for those index not checked, clear off the correspond index "basicSal" field value.
    e.g. ChkNicno[1] is not checked, empty basicSal[1] value before submission.
    This will give us only selected rows values.
    2) retain the code
    String[] value = request.getParameterValues("ChkNicno");
    String[] bs = request.getParameterValues("basicSal");at 2nd jsp, as now the http request will pass parameters using "ChkNicno" and "basicSal".
    3) some change to the code for optimization
    for(int i=0; i < value.length; i++){
         String temp = value;     
         for(int x=0; x < bs.length; x++){
              String basic = bs[x];
              pstmt2 = connection.prepareStatement(sql2);
              pstmt2.setString(1, temp);
              pstmt2.setString(2, basic);
              int RowCount1= pstmt2.executeUpdate();
         pstmt1 = connection.prepareStatement(sql);
         pstmt1.setString(1, temp);
         pstmt1.setString(2, interviewDate);
         int RowCount= pstmt1.executeUpdate();
    to
    pstmt1 = connection.prepareStatement(sql);
    pstmt2 = connection.prepareStatement(sql2);
    for(int i=0; i < value.length; i++){
         String temp = value;     
         for(int x=0; x < bs.length; x++){
              String basic = bs[x];
              pstmt2.setString(1, temp);
              pstmt2.setString(2, basic);
              int RowCount1= pstmt2.executeUpdate();
         pstmt1.setString(1, temp);
         pstmt1.setString(2, interviewDate);
         int RowCount= pstmt1.executeUpdate();
    preparestatement created once should be sufficient as we do not change the sql statement throughout the loop.
    there are better solutions out there, this just some ideas and suggestions.Do try out if you wish.
    Hope it helps. : )

  • SQL profile - need help please

    Hi folks
    Enterprise Manager suggested a better plan for me (Oracle 10.2.3 /
    Solaris64) and I went for it. However, it doesn't look like it's being
    used at all. EM still shows the SQL using the inefficient plan.
    So I reckoned the force_match was the issue (even tho the SQL uses all bind variables - that might not be right though?)
    SQL> l
    1 begin
    2 dbms_output.put_line(
    3 dbms_sqltune.accept_sql_profile(
    4 task_name => 'SQL_TUNING_1271147514497',
    5 name => 'SYS_SQLPROF_0149fdae48460004',
    6 replace => true,
    7 force_match => true)
    8 );
    9* end;
    SQL> /
    SYS_SQLPROF_0149fdae48460004
    PL/SQL procedure successfully completed.
    SQL> select force_matching from dba_sql_profiles where name =
    'SYS_SQLPROF_0149fdae48460004';
    FOR
    NO
    Can anyone advise why this might be please ? The Tuning ID in EM is
    correct (that's where I got it from).
    Basically, I have
    Operation Object Object Type Order Rows Size (KB) Cost Time (sec) CPU
    Cost I/O Cost
    SELECT STATEMENT
    11
    743
    NESTED LOOPS
    10 4 0.496 743 9 39626522 733
    NESTED LOOPS
    7 4 0.453 735 9 39563064 725
    VIEW
    4 4 0.254 730 9 39499102 720
    HASH UNIQUE
    3 4 0.156 730 9 39499102 720
    FILTER
    2
    INDEX RANGE SCAN
    HCREF.S436_IX1 INDEX (UNIQUE) 1 4 0.156 729 9 35552327 720
    TABLE ACCESS BY INDEX ROWID
    HCREF.F436 TABLE 6 1 0.050 2 1 16553 2
    INDEX UNIQUE SCAN
    HCREF.F436_UK1 INDEX (UNIQUE) 5 1
    1 1 9021 1
    TABLE ACCESS BY INDEX ROWID
    HCREF.MMLINE TABLE 9 1 0.011 2 1 16673 2
    INDEX UNIQUE SCAN
    HCREF.A436_IX1 INDEX (UNIQUE) 8 1
    1 1 9021 1
    MMLINE should be above F436 in the plan for optimum performance. All
    stats are up to date, and the TEST system does it the right way. I
    can't find anything to account for the different plan (sga, pga, IO,
    parameters, anything!).
    Any help as to how I can force LIVE to do what TEST is doing? If the
    force-match takes effect, I'd like to assume that would have sorted
    it ? We have no access to the underlying SQL.
    SELECT /*+ LEADING INDEX(S_ S436_IX1) INDEX(SHAPE F436_UK1)
    INDEX(MMLINE A436_IX1) */ HCREF.MMLINE.FEATCODE,
    HCREF.MMLINE.SHAPE ,S_.eminx,S_.eminy,S_.emaxx,S_.emaxy ,SHAPE.fid,SHAPE.numofpts,SHAPE.entity,SHAPE.points,SHAPE.rowid
    FROM (SELECT /*+ INDEX(SP_ S436_IX1) */ DISTINCT sp_fid, eminx, eminy,
    emaxx, emaxy FROM HCREF.S436 SP_ WHERE SP_.gx >= :1 AND SP_.gx <= :2
    AND SP_.gy >= :3 AND SP_.gy <= :4 AND SP_.eminx <= :5 AND SP_.eminy
    <= :6 AND SP_.emaxx >= :7 AND SP_.emaxy >= :8) S_ , HCREF.MMLINE ,
    HCREF.F436 SHAPE WHERE S_.sp_fid = SHAPE.fid AND S_.sp_fid =
    HCREF.MMLINE.SHAPE
    Thanks
    A

    Anyone got any suggestions ? Much appreciated, thanks.
    A

  • I can't figure out how to parametrize my SQL statement - lil help please?

    Hi all,
    I was deleting records via the string-concatenation method, which I've come to understand is bad, due to security any possibly other issue. I want very much to parametrize my delete statement, but I just can't see to get it to work
    The code below is my best shot at it - it returns an Oracle exception about "invalid table name". I assume that means the the substitution of the parameter for the value simply hasn't been performed, so the database is trying to process literally ":oracleTable", and the like.
    Can someone please set me straight with this?
    Thanks for any help,
    cdj
              public static void DeleteTest(DateTime start, DateTime end)
                   ParentFormStatusBar.Text = "Deleting records...";
                   string oracleStart = start.ToString("dd-MMM-yyyy");
                   string oracleEnd = end.ToString("dd-MMM-yyyy");
                   string strConn = "CONNECTSTRING";
                   OracleConnection dc_UAT = new OracleConnection(strConn);
                   string oracleTable = "DATABASETABLE";
                   OracleCommand oc = new OracleCommand();
                   oc.BindByName = true;
                   oc.CommandText = "delete from :oracleTable where as_of_date between :oracleStart and :oracleEnd";
                   oc.Connection = dc_UAT;
                   OracleParameter tableParam = new OracleParameter();
                   tableParam.ParameterName = "oracleTable";
                   tableParam.Value = oracleTable;
                   tableParam.OracleDbType = OracleDbType.Varchar2;
                   tableParam.Direction = ParameterDirection.Input;
                   OracleParameter startParam = new OracleParameter();
                   startParam.ParameterName = "oracleStart";
                   startParam.Value = start;
                   startParam.OracleDbType = OracleDbType.Date;
                   startParam.Direction = ParameterDirection.Input;
                   OracleParameter endParam = new OracleParameter();
                   endParam.ParameterName = "oracleEnd";
                   endParam.Value = end;
                   endParam.OracleDbType = OracleDbType.Date;
                   endParam.Direction = ParameterDirection.Input;
                   oc.Parameters.Add(tableParam);
                   oc.Parameters.Add(startParam);
                   oc.Parameters.Add(endParam);
                   MessageBox.Show(tableParam.Value.ToString()+ "\n" + oc.CommandText+"\n" + "Params: " + oc.Parameters.Count);
                   int rowsAffected;
                   try
                        dc_UAT.Open();
                        rowsAffected = oc.ExecuteNonQuery();
                        dc_UAT.Close();
                        ParentFormStatusBar.Text = rowsAffected.ToString() + " records deleted.";
                   catch(Exception ex)
                        ParentFormStatusBar.Text = "Delete error: " + ex.Message;
              }

    It helped oodles - thanks a jillion!
    Is there a master list somewhere of things you can and cannot parametrize? That would be cool.
    I guess I was thinking of parameters oversimplistically as just a canned-search-and-replace-text function or something like that.
    Thanks again,
    cdj

  • PL/SQL Function Syntax help please...

    Can someone help me with the syntax here please? I am sure i am doing something wrong in my LOOP.
    create or replace FUNCTION fcn_chk_dec(p_date number)
    return NUMBER
    as
    --DECLARE
    v_date NUMBER;
    v_active NUMBER;
    v_prev NUMBER;
    v_delta NUMBER;
    v_perc_delta NUMBER:
    CURSOR c_prev_active IS
         select date,people,
    lag(people,1) over (order by date)
         from stats
    where date between to_date(p_date, 'YYYYMMDD')-2 and to_date(p_date, 'YYYYMMDD')-1
         order by date desc
    BEGIN
         OPEN c_prev;
    loop
         FETCH c_prev INTO v_date,v_active,v_prev;
         exit when c_prev%NOTFOUND;
         v_delta:=v_active-v_prev;
    v_perc_delta:=trunc((v_delta/v_active*100),2)
    end loop;
    close c_prev;
    return v_perc_delta;
    END fcn_chk_dec;

    what i am trying to do is create a funtion that will return one value for the first row that comes back.
    here is my initial query. the reason i did not go with this query is because there are too many selects and i was told that's not good and slows down the system. Plus, i need to have a function call in another program that will access this function to compare it's output to a value in a table.
    here was my initial start:
    select date,people,delta,trunc((delta/people*100),2) as perc_delta
    from (select date, people,people-prev_dly_people as delta
    from
    (select date,people,
    lag(people,1) over (order by date) as prev_dly_people
    from stats
    where date between to_char(sysdate-2,'YYYYMMDD') and to_char(sysdate-1,'YYYYMMDD')
    order by date desc))
    basically, i have a table that has a total number of people. I want to get the percentage growth and decline from the most recent date and the date before it. This will give me a day to day percentage of people population change as of the most recent date.
    I need this to be a function becaus i want to be able to pass any date i want into it and get the given delta percentage at the time for the people's population.
    hope this makes sense.

  • SQL problem URGENT help PLEASE

    SQL> select period_number, sum(gross_amt)
    2 from mpy_payslip_headers
    3 where payroll_year = 2001
    4 and business_group_id = 'E4'
    5 and employee_number = '366'
    6 and period_number between 12 and 13
    7 group_by period_number;
    group_by period_number
    ERROR at line 7:
    ORA-00933: SQL command not properly ended
    WHY THIS ERROR? As far as I know it is possible.
    Thanks in advance,
    Marija

    Sometimes, the most obvious things are the harder to see...
    The correct is 'order by', not 'order_by'!

  • SQL insert statement help please

    alternative is to have the table with field dateadd with default value of getdate()   - then do not include in your insert statement - then the modify date use and update - starting point - my two cetns

    Hi all I'm trying to go a little out of my comfort level here and was hoping for some advice. I have a sql table that has 2 date fields. an add and a modified. If the modified date is null then I want to calculate on the date added. Otherwise I'd like to calculate on the modified date.
    Here is a simplified version of what I'm trying to accomplish.
    Hope it makes sense what I'm trying to do.
    SQLSELECT field1,field2.... ,dateAdded , dateModifiedINTO tblOutputFROM tblInput/* some pseudo code here */WHERE (if dateModified not null then ( dateModified

  • HTML not working in PL/SQL block..Help me ASAP

    declare
    l_col VARCHAR2(30) :=to_number(to_char(to_date('01-feb-2011','dd-mon-yyyy'),'dd'));
    CURSOR name_cur IS
      select name
          from   od_shift_schedule
          where   year=2011
          and    (month)=('Feb')
           and    decode(l_col,1,"01",2,"02",3,"03",4,"04",5,"05",6,"06",7,
                         "07",8,"08",9,"09",10,"10",11,"11",12,"12",13,"13",14,"14",15,"15",16,"16",17,"17",18,"18",19,"19",20,"20",
                         21,"21",22,"22",23,"23",24,"24",25,"25",26,"26",
                       27,"27",28,"28",29,"29",30,"30",31,"31")='W';
    BEGIN
      DELETE FROM nam;
      commit;
      FOR i IN name_cur
      LOOP
      dbms_output.put_line(i.name);
      htp.p('<b>Employee '||i.name||'  has been ticked.
       </b><br/>');
      EXECUTE IMMEDIATE 'insert into nam(name) values('''||i.name||''')';
      commit;
    END LOOP;
    end;Kindly help me with this
    If i'm wrong here kindly help me that how can i place a display message

    Re: HTML not working in PL/SQL block..Help me ASAP
    Using the community discussion forums for urgent issues is rude and a violation of the terms and conditions.
    http://www.oracle.com/html/terms.html
    >
    4. Use of Community Services
    Community Services are provided as a convenience to users and Oracle is not obligated to provide any technical support for, or participate in, Community Services. While Community Services may include information regarding Oracle products and services, including information from Oracle employees, they are not an official customer support channel for Oracle.
    You may use Community Services subject to the following: (a) Community Services may be used solely for your personal, informational, noncommercial purposes; (b) Content provided on or through Community Services may not be redistributed; and (c) personal data about other users may not be stored or collected except where expressly authorized by Oracle
    >
    Also please read the FAQ on how to ask questions.
    SQL and PL/SQL FAQ
    >
    2) Thread Subject line
    Give your thread a meaningful subject, not just "help please", "Query help" or "SQL". This is the SQL and PL/SQL forum. We know your question is going to be about those things, make it meaningful to the type of question so that people with the right sort of knowledge can pick it up and those without can ignore it. Never, EVER, mark your subject as "URGENT" or "ASAP"; this forum is manned by volunteers giving their own time to help and your question is never urgent or more important than their own work or than other people's questions. It may be urgent to you, but that's not forum members issue.

  • How to get reports cumulated balances? need help please

    Dear all,
    I need your help please in this issue.
    I am creting a report using reports designer in oracle, well the fact is i don't know how to do the following:
    if i have for example in the report the following to be diplayed :
    Date Amount Balance
    25/5/2011 2000
    27/5/2011 5000 should be calculated and equal to 2000+5000=*7000*
    28/5/2011 4000 calculated and equal to 7000 + 4000=*11000*
    29/5/2011 1000 calculated equal to 11000 + 1000 = 12000
    what is the method so i can get the balance values calculated 7000, 11000 and 12000? what do i do? any hints please
    thanks for your help

    Using analytic function can be done through query as below...
    SQL> SELECT EMPNO, ENAME, SAL, SUM(SAL) OVER (ORDER BY SAL ROWS UNBOUNDED PRECEDING) RUNNING_BALANCE
      2  FROM SCOTT.EMP
      3  /
         EMPNO ENAME             SAL RUNNING_BALANCE
          7369 SMITH             800             800
          7900 JAMES             950            1750
          7876 ADAMS            1100            2850
          7521 WARD             1250            4100
          7654 MARTIN           1250            5350
          7934 MILLER           1300            6650
          7844 TURNER           1500            8150
          7499 ALLEN            1600            9750
          7782 CLARK            2450           12200
          7698 BLAKE            2850           15050
          7566 JONES            2975           18025
          7788 SCOTT            3000           21025
          7902 FORD             3000           24025
          7839 KING             5000           29025
    14 rows selected.
    SQL> -Ammad

  • Servlet not inserting into Access Databse. help please

    I have the following code which is inserting three fields into a database. The database name is contacts.mdb, and the table is contacts. I have setup the ODBC connection on the server, of which I have both IIS and Tomcat running. The form.html that I am accessing is on the tomcat server root and that code is below as well. After hitting the submit button on the form I get forwarded to the servlet, and the page is blank. However, when I open the database, no updates have occured. Please help. I hope I have provided enough detail. Thanks so much.
    -------- servlet code start --------------
    import java.sql.*;
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class WebServlet
    extends HttpServlet {
    public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException,
    IOException {
    try{
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    String sourceURL = "jdbc:odbc:terry_web_contacts";
    Connection databaseConnection = DriverManager.getConnection(sourceURL);
    Statement stmt = databaseConnection.createStatement();
    String jname = request.getParameter("Name");
    String jemail = request.getParameter("Email");
    String jcomments = request.getParameter("Comments");
    String sqlInsertString ="INSERT INTO contacts (name, email, comments) VALUES ('" + jname +"', '" jemail "', '" + jcomments + "')";
    stmt.executeUpdate(sqlInsertString);
    databaseConnection.close();
    catch(ClassNotFoundException cnfe)
    System.err.println("Error loading Driver");
    catch (SQLException sqle){
    System.err.println("SQL Error");
    ---------- servlet code end ---------------------
    ---------- html form code start ------------------
    <HTML>
    <HEAD>
    <TITLE>Example</TITLE>
    </HEAD>
    <BODY BGCOLOR="WHITE">
    <TABLE BORDER="2" CELLPADDING="2">
    <TR><TD WIDTH="275">
    <H2>I'm a Simple Form</H2>
    <FORM METHOD="POST" ACTION="/servlet/WebServlet">
    <p>
    <INPUT NAME="Name" TYPE="TEXT" id="Name" SIZE=30>
    </p>
    <p>
    <INPUT NAME="Email" TYPE="TEXT" id="Email" SIZE=30>
    </p>
    <p>
    <textarea name="Comments" id="Comments"></textarea>
    </p>
    <P>
    <INPUT TYPE="SUBMIT" VALUE="Click Me">
    <INPUT TYPE="RESET">
    </FORM>
    </TD></TR>
    </TABLE>
    </BODY>
    </HTML>
    ------------- html code end ------------------

    Okay, here is my modified code. However, I catch a sql error. It prints out "sql error". If I try to isolate the different lines of code with try catch blocks, the compiler says it does not recognize the symbols for example stmt, or databaseConnection. Arggh, what can I do? Help please.
    import java.sql.*;
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class WebServlet
        extends HttpServlet {
      public void doPost(HttpServletRequest request, HttpServletResponse response)
         throws ServletException,IOException
         PrintWriter out = response.getWriter();
         String jname = (String) request.getParameter("Name");
         String jemail = (String) request.getParameter("Email");
         String jcomments = (String) request.getParameter("Comments");
    try
          Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    catch(ClassNotFoundException e)
         out.println("class error");
    try
         Connection databaseConnection = DriverManager.getConnection("jdbc:odbc:terrycontacts");
         Statement stmt = databaseConnection.createStatement();
         String sqlInsertString ="INSERT INTO contacts(name,email,comments) VALUES('"+jname+"','"+jemail+"','"+jcomments+"')";
         stmt.executeQuery(sqlInsertString);
         databaseConnection.commit();
         databaseConnection.close();
    catch(SQLException e)
         out.println("sql error");
         out.close();
    }

  • Database don't delete prom the table, help please !!

    there is my code :
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
    Connection con=DriverManager.getConnection(jdbc:odbc:Medic);
    con.setReadOnly(false);
    try{
    Statement st=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
    int res=st.executeUpdate("DELETE FROM PATIENT WHERE PATIEN_ID="+id+";");
    System.out.println(String.valueOf(res)+" rows deleted");
    st.close();
    }catch(Exception exc){
    System.out.print(exc+"\n");
    the code execute with no error or exception , the message that i recieve is "1 rows deleted" and i want delete just one row, it's ok until the moment but whene i read the table i see that the row is not deleted.
    I use dBase database, help please !!!
    Thanks

    Don't trust the return value.
    Because you got no exception it means that the SQL executed. SQL can execute without deleting anything however if the where clause does not match.
    As posted your code is not valid java so anything else is meaningless.

  • Encountered Incompatible combination of objects (QP0004) error! help please

    Support Case for BOXI
    Title: encountered Incompatible combination of objects (QP0004) error!
    BOXI version: Business Objects boe XIR2 SP2
    OS: PARISC HPUX 11.11
    Description:
    In the Customer Inventory report document, there are three report tabulation and three filter conditions to limit Display relevant customer and date result
    It works incorrectly while the report has three filter conditions,but two filter conditions it works correctly. in the begin i doubt the generate sqls are incorrectly,i copy the sql sentence in the sqlplus envirement and execute , sql sentence syntax and result were correctly.but in BO Edit Query when the report has three filter conditions,i click SQL button and generate sqls there display error .
    so i checked design object and found out why will appear this error, in the designer I put this object(name is 'Is Srvc Level Created in time frame') into Query panel, then click SQL button generate sql,
    This mistake will show:'Incompatible combination of objects (QP0004)'
    'Is Srvc Level Created in time frame' object sql code as follows:
    select:
               CASE WHEN @Select(Service Level\Service Level Creation Date) >= @Select(Time\TIME - Period Start Date) AND @Select(Service Level\Service Level Creation Date)  <= @Select(Time\TIME - Period End Date) THEN 1 ELSE 0 END
    where:
    filter conditions generate sqls like below sentence,please pay attention to bold sentence:
    SELECT
    /*+ LEADING(time_dim) */ 1,
    CUSTOMER_DIM.NAME,
    ( SI_AND_SCI_DIM.LABEL )||' ('||( SI_AND_SCI_DIM.NAME )||')',
    ( SLA_DIM.LABEL )||' ('||( SLA_DIM.NAME )||')',
    CAST(SI_AND_SCI_DIM.DELETION_DATE AS DATE),
    CAST(SLA_DIM.CREATION_DATE AS DATE),
    CAST(SLA_DIM.DELETION_DATE AS DATE),
    ( CUSTOMER_DIM.LABEL )||' ('||( CUSTOMER_DIM.NAME )||')'||'['||( CUSTOMER_DIM.ID )||']',
    CAST(SI_AND_SCI_DIM.CREATION_DATE AS DATE),
    SLA_DIM.NAME,
    CAST(CUSTOMER_DIM.CREATION_DATE AS DATE),
    CASE WHEN ( CAST(SLA_DIM.CREATION_DATE AS DATE) ) >= ( CAST(bo_tools.from_gmt_to_time_zone(TIME_FRAME_START.FULL_DATE) AS DATE) ) AND ( CAST(SLA_DIM.CREATION_DATE AS DATE) ) <= ( CAST(bo_tools.from_gmt_to_time_zone(TIME_FRAME_END.FULL_DATE) AS DATE) ) THEN 1 ELSE 0 END,
    CASE WHEN ( CAST(SI_AND_SCI_DIM.CREATION_DATE AS DATE) ) >= ( CAST(bo_tools.from_gmt_to_time_zone(TIME_FRAME_START.FULL_DATE) AS DATE) ) AND ( CAST(SI_AND_SCI_DIM.CREATION_DATE AS DATE) ) <= ( CAST(bo_tools.from_gmt_to_time_zone(TIME_FRAME_END.FULL_DATE) AS DATE) ) THEN 1 ELSE 0 END,
    CASE WHEN ( CAST(SL_DIM.CREATION_DATE AS DATE) ) >= ( CAST(bo_tools.from_gmt_to_time_zone(TIME_FRAME_START.FULL_DATE) AS DATE) ) AND ( CAST(SL_DIM.CREATION_DATE AS DATE) ) <= ( CAST(bo_tools.from_gmt_to_time_zone(TIME_FRAME_END.FULL_DATE) AS DATE) ) THEN 1 ELSE 0 END FROM
    SI_AND_SCI_DIM,
    CUSTOMER_DIM,
    SLA_DIM,
    TIME_DIM TIME_FRAME_START,
    TIME_DIM TIME_FRAME_END,
    GRANULARITY_DIM,
    SI_VIEW_SCI_HEALTH,
    VIEW_TIME_DIM
    WHERE
    ( CUSTOMER_DIM.ID=SI_VIEW_SCI_HEALTH.DM$CUSTOMER_REF )
    AND ( SI_VIEW_SCI_HEALTH.DM$TIME_REF=VIEW_TIME_DIM.ID )
    AND ( SI_VIEW_SCI_HEALTH.DM$SI_OR_SCI_REF=SI_AND_SCI_DIM.ID )
    AND ( SI_VIEW_SCI_HEALTH.DM$GRANULARITY=GRANULARITY_DIM.KEY_ID )
    AND ( VIEW_TIME_DIM.ID>=TIME_FRAME_START.ID )
    AND ( VIEW_TIME_DIM.ID<TIME_FRAME_END.ID )
    AND ( SI_VIEW_SCI_HEALTH.DM$SLA_REF=SLA_DIM.ID )
    AND ( SI_AND_SCI_DIM.IS_SERVICE = 'T' )
    AND ( SLA_DIM.CUSTOMER_REF = ( CUSTOMER_DIM.ID ) )
    AND
    ( ( CUSTOMER_DIM.LABEL ) in decode(@Prompt('Choose Customer','A','Customer\Customer Label',MONO,FREE), '*', ( CUSTOMER_DIM.LABEL ), @Prompt('Choose Customer','A','Customer\Customer Label',MONO,FREE)) )
    AND
    ( ( TIME_FRAME_START.ID ) = bo_tools.getFirstTimeRef(
    'M',
    NULL,
    'YYYY/MM',
    @Prompt('Enter month and year (date format: YYYY/MM)','A',,MONO,FREE))
    AND
    ( TIME_FRAME_END.ID ) = bo_tools.getLastTimeRef(
    'M',
    @Prompt('Enter month and year (date format: YYYY/MM)','A',,MONO,FREE),
    'YYYY/MM') )
    AND
    GRANULARITY_DIM.KEY_ID = 'M'
    However at the same time, if there has third filter condition,BO Edit Query can not generate sqls and display error.
    I confirm by checking the sqls sentence in the sqlplus, the results are correctly.but in BO Edit Query are not correctly.
    Any one who encountered this before? ,I post this message asking for help and hope it can be fixed soon.
    if you need more info I can send you screen shot, thanks!

    Sorry I didn't read the whole thing above.. But I can advice you as I encountered the same error.
    It happened to me because of a loop that was forming between the tables .
    loop in the sense: A-B-C-D-A
    When i checked Short Cut join in the join properties I was not getting this error message. but... it was joining through a different longer path. It was then I realized that it had a loop. You can have a careful look to see if you are having the same issue. hope it helps people in future.

  • b font color ='red' Java JDBC and Oracle DB URGENT HELP PLEASE /font /b

    Hello, I am a newbie. I'm very interested in Java in relation to JDBC, Oracle and SAP.I am trying to connect to an Oracle DB and I have problems to display the output on the consule in my application. What am I doing wrong here . Please help me. This is my code: Please Explain
    import java.sql.*;
    import java.sql.DriverManager;
    import java.sql.Connection;
    public class SqlConnection {
         public static void main(String[] args) {
              Class.forName("oracle.jdbc.driver.OracleDriver"); //Loading the Oracle Driver.
              Connection con = DriverManager.getConnection
              ("jdbc:orcle:thin:@34.218.5.3:1521:ruka","data","data"); //making the connection.
              Statement stmt = con.createStatement ();// Sending a query to the database
              ResultSet rs = stmt.executeQuery("SELECT man,jean,test,kok FROM sa_kostl");
              while (rs.next()) {
                   String man = rs.getString("1");
                   String jean = rs.getString("2");
                   String test = rs.getString("3");
                   String kok = rs.getString("4");
                   System.out.println( man, jean, test,kok );//here where my the
                                                 //compiler gives me errors
              stmt.close();
              con.close();
    }

    <b><font color ='red'>Java JDBC and Oracle DB URGENT HELP PLEASE</font></b>Too bad your attempt at getting your subject to have greater attention failed :p

  • Data pump PL SQL API ;;; PLZ HELP ME

    Hi all,
    I want to use the data pump PL SQL API provided by Oracle ; I have created one procedure named SP_EXPORT as showing below ;
    But the problem that I have this error message : any suggestion, help please ?
    ORA-31626: job does not exist
    ORA-06512: at "SYS.DBMS_SYS_ERROR", line 79
    ORA-06512: at "SYS.DBMS_DATAPUMP", line 911
    ORA-06512: at "SYS.DBMS_DATAPUMP", line 4356
    ORA-06512: at line 7
    CREATE OR REPLACE PROCEDURE SP_EXPORT AS
    l_dp_handle NUMBER;
    l_last_job_state VARCHAR2(30) := 'UNDEFINED';
    l_job_state VARCHAR2(30) := 'UNDEFINED';
    l_sts KU$_STATUS;
    BEGIN
    l_dp_handle := DBMS_DATAPUMP.open(
    operation => 'EXPORT',
    job_mode => 'SCHEMA',
    remote_link => NULL,
    job_name => 'EMP_EXPORT',
    version => 'LATEST');
    DBMS_DATAPUMP.add_file(
    handle => l_dp_handle,
    filename => 'MIVA_DEVXEN03.dmp',
    directory => 'DATAPUMP_DIR');
    DBMS_DATAPUMP.add_file(
    handle => l_dp_handle,
    filename => 'MIVA_DEVXEN03.log',
    directory => 'DATAPUMP_DIR',
    filetype => DBMS_DATAPUMP.KU$_FILE_TYPE_LOG_FILE);
    DBMS_DATAPUMP.metadata_filter(
    handle => l_dp_handle,
    name => 'SCHEMA_EXPR',
    value => '= ''MIVA''');
    DBMS_DATAPUMP.start_job(l_dp_handle);
    DBMS_DATAPUMP.detach(l_dp_handle);
    END;

    I ' connected as sysdba and it works ; wow very happy ;)

  • I keep being asked to update my Safari but when I do a Software update it scans but never gives me a list and just says no new updates. Help please!

    I keep being asked to update my Safari but when I do a Software update it scans but never gives me a list and just says no new updates. Help please!

    There are no updates to either OS 10.5.8 or Safari 5.0.6.
    If you need a later version of Safari you must first upgrade your operating system to a later version of OS X.

Maybe you are looking for