Small SQL problem

Hello,
I have a small SQL problem...
I am designing an online bank using servlets for a university project and it allows customers to view their statements. They select which of their account numbers they want to view the statement for and the start and end date of the statement.
The problem lies with the dates. Here is the SQL:
SELECT date, details, amount, balance
FROM HISTORY
WHERE bankaccnumber=13494925 And date>=1/1/01 And date<=31/1/01;
All of the books I have looked at show dates in '1/1/01' format but whenever I try it this way I get a 'Data type mismatch in criteria expression' error (the 'date' field in the Database IS a Date type).
Although, whenever I run the query in Access and prompt the user to enter the start and end date, it works fine.
I have spoken to a few people and no-one seems to know why it is not working.
Any ideas???
Thanks

If your database is MS Access and you don't expect to switch to something else, then write this:
SELECT date, details, amount, balance
FROM HISTORY
WHERE bankaccnumber=13494925 And [date]>=#1/1/01# And [date]<=#1/31/01#
Note that you MUST format your dates as MM/DD/YY and not as DD/MM/YY, that's an Access rule, and that you will probably have to "quote" your column name "date", which I think is a reserved word in SQL and hence a bad choice for column name.
Personally I always use PreparedStatements. That way my SQL would look like this:
SELECT date, details, amount, balance
FROM HISTORY
WHERE bankaccnumber=13494925 And date>=? And date<=?
and I would use the setDate() method to fill in the parameters. Since this method uses a Date as a parameter, I don't need to fight with date formats, the JDBC driver handles that for me.

Similar Messages

  • Two SQL problems

    First problem...
    SQL root will not access all databases...
    If I try to access al databases using SQL Administrator the connection is refused even if I use root.
    all databases are accessable va individual username and password..
    Tried changing root password with GUI but makes no difference...
    Second SQL problem...
    10.4.11 server failed all raid volumes so corrupted no rescue was possible on any volume reinstall failed as well...
    Have rebuilt the server using 10.5.6 I will have to manually import the SQL databases from the old server... what do I do ??? I cannot boot the old server so cannot do an SQL export or anything...
    Thanks...

    Hi Jun,
    Can i contribute a little for ur 2nd problem.
    This error is coz, If u are using a filter against a File "data store" u can't test it, only against RDBMS query will be tested at data store level.
    Well, for using that filter and make sure its working, drag and drop the source file in the interface (u can get the filter) and make it to execute on STAGING.
    Thanks,
    Guru

  • Can Lincat find big endian and small endian problem?

    Hi, I want to migrate a project from linux to solaris. And I read that lincat can save a lot of time in migration. But when I tried with lincat. I found that what is found is mainly the difference between linux API and solaris API. I use the following
    codes:
    #include <stdio.h>
    #include <stdlib.h>
    int main(int argc, char *argv[])
    int flagVal = 0x01020304;
    char cptr = (char )&flagVal;
    printf("Val is %d\n", *cptr);
    my lincat does not find the big endian and small endian problem. I also wonder whether lincat can find the misaligned problem and "32 bits and 64 bits" problem. Could you please tell me? I didn't find the answer from lincat manual.
    Edited by: baiwd on May 6, 2008 6:03 PM

    Hi Ankit,
    You may use "Cross Platform Transportable Tablespaces" method if the endian format is different between source and target platforms. Please have a look at Oracle's "Platform Migration Using Transportable Tablespaces" document for more information: http://www.oracle.com/au/products/database/maa-wp-11g-platformmigrationtts-129269.pdf
    Please note that "Transportable Database" is a different feature and can only be used to migrate a new database platform that has the same endian format.
    BR,
    Alper Somuncu

  • Regroup a lot of small sql request

    hello
    I'am developping a server in c
    This server connects to a database
    I use oo4o for the connection
    But I have I problem because I have a lot of small request like that
    select cdf_nom
    from cdf_codif, fitty_typeinteraction
    where
         fitty_fit_code_fk_pk like '183'
         and fitty_cdf_type_code_fk_pk = cdf_code_pk
         and cdf_numero_pk like 'IY'
    All works ok but the application is too slow because I have a function in c by request like that
         strcpy(sqls,"select cdf_nom");
         strcat(sqls," from splab_specialite_labo, cdf_codif");
         strcat(sqls," where");
         strcat(sqls," splab_sp_code_fk_pk like '");
         strcat(sqls,idLabo);
         strcat(sqls,"' ");
         strcat(sqls," and splab_cdf_lab_code_fk_pk = cdf_code_pk");
         strcat(sqls," and cdf_numero_pk like '15'");
         /* execute la requete */
         requete.Open(*databb,sqls);
         while (!requete.IsEOF())
              /* balise statutLabo */
              requete.GetFieldValue("cdf_nom", statutLabo,TAILLE_CDF_NOM);
              if (strlen(statutLabo) != 0)
                   bstrValue = AsciiToBSTR(statutLabo);
                   if (!bstrValue)
                        ERROR1("Theriaque : AsciiToBSTR function failed");
                        goto shutdown ;
                   cleanAllString(bstrValue);
                   elementNode = requestDoc->CreateNode(NODE_ELEMENT, V_StatutLabo, rootRequestNode, bstrValue);
                   if (!elementNode)
                        ERROR1("Theriaque : creation of element node failed");
                        goto shutdown ;
                   SAFERELEASE(elementNode);
                   if (bstrValue) SysFreeString(bstrValue);
                   bstrValue = NULL ;
              requete.MoveNext();
    I would like to know how to optimise it but I can't regroup all the small request in a big requestbecause it's to slow
    If it's possible a pl/sql bloc it's will be great

    Usually very large directories suffer from bad access times. If you have a single directory with nearly a million files, you will discover that the time for opening the file is much greater than the time for reading it.
    If you have a directory tree containing the files (say that you have a directory, with 100 subdirectories, each one containing 100 subdirectories, each one containing 100 files) you can open the files much faster.

  • SQL Problems

    Hey Ppl,
    Ok i have a problem getting my Insert Into SQL to work.... i've created a small program that inputs information directly into the database... but even then i get a syntax error with my insert into statement...
    if you guyz can look at it and tell me where my problem lies... it'll be Cool...
         public class HAddSQL {
              public static void main (String args []){
                   String url = "jdbc:odbc:PP";
                   Connection con;
                   Statement stmt;
                   String query = "select * from HarvestFile";
                   try {
                        Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                   catch(java.lang.ClassNotFoundException e){
                   System.err.print("ClassNotFoundException: ");
                   System.err.print("/n"+e.getMessage());
                   try{
                        con = DriverManager.getConnection(url);
                        stmt = con.createStatement();
                        stmt.executeUpdate("insert into HarevestFile" +
                                                      "values('MG002', 'NS001', 03/24/2001, 250, 0, 95.40, 'Samad', 'CRAZY')");
                        ResultSet rs = stmt.executeQuery(query);
                        System.out.println("Test For This SQL Experiment");
                        while(rs.next()){     
                             String s = rs.getString("TreeID");
                             String a = rs.getString("SegmentCode");
                             System.out.println(s + " " + a);
                        stmt.close();
                        con.close();
                        catch(SQLException ex){
                             System.err.println("SQLException: " + ex.getMessage());
    I'm using Microsoft Access btw...
    ok... another question... does anyone know how to save the date a document was saved in a database... like for instance.... if i had a interface and i was to fill in the information.... when i click submit... the database captures the date that it was submitted???
    I'm a newbie in this so you'll have to go easy on me ok?
    Thanx ppl...
    ~John~

    ok hi partha....
    thanx for keeping in touch till now...
    ok this is a small portion of what i have done to my java.sql.* it's part of an interface... whereby when the user enters the values in a textfield... the interface sends it to the database.... ok here it is
    con = DriverManager.getConnection(url);
                             java.sql.Date date = new java.sql.Date(System.currentTimeMillis());
                             stmt = con.createStatement();
                             stmt.executeUpdate("insert into HarvestFile (" +
                                                           "TreeID, SegmentCode, NumberOfTrees, NumberRemaining," +
                                                           "Revenue, ForestOfficer, Comments" +
                                                           ") values ('" +
                                                           tf1.getText() + "','" +
                                                           tf0.getText() + "','" +
                                                           tf5.getText() + "','" +
                                                           tf7.getText() + "','" +
                                                           tf6.getText() + "','" +
                                                           tf8.getText() + "','" +
                                                           tf9.getText() + "')");
                             ResultSet rs = stmt.executeQuery(query);
                             System.out.println("Display Success Results:");
                             while(rs.next()){     
                             String s = rs.getString("TreeID");
                             String a = rs.getString("SegmentCode");
                             System.out.println(s + " " + a);
                             stmt.close();
    ok... see what you can make of this....
    i've tried it out... and well... i just can't get the date to appear.... i'll keep trying anyways... .
    Do send me your ideas... .
    Thanx....
    Regards
    John

  • Sql problem, pivot question?

    Hi guys,
    I have an interesting problem and do not manage to find a sollution.
    I need to create a report, and we call it variance/trending report. let me explain.
    I have a table that holds all employess with their salaries, every month.
    currenly my selects gets all employess with their salaries from current and previous month. and the result looks like:
    Employee_iD| Salary| month
    1          |500   |   C
    2          |100   |   P
    1          |650   |   P
    3          |100   |   p
    3           |180   |   C
    how can I do my select so I can see the result, in different columns, in a manner in which I can compare the salaries between them (from current and previous month):
    Employe_iD| current_month| previous_month | variance
    1        |500                 | 650                 | -150
    2        |                      | 100                 |
    3        |180                 |100                   |80you can see that C, measn current month, and P measn previous month.
    I think I will have data in my select for both, previous and current. If not, I will treat it as zero.
    I gave a simple exemple . My select is a little more complex.
    any help is appreciated.
    Thanks

    May be..
    SQL> WITH tbl AS (SELECT 1 empid,500 sal,'C' mon FROM DUAL UNION ALL
      2               SELECT 2 empid,100 sal,'P' mon FROM DUAL UNION ALL
      3               SELECT 1 empid,650 sal,'P' mon FROM DUAL UNION ALL
      4               SELECT 3 empid,100 sal,'P' mon FROM DUAL UNION ALL
      5               SELECT 3 empid,180 sal,'C' mon FROM DUAL
      6               )
      7  SELECT empid,NVL(MAX(DECODE(mon,'P',sal)),0) previous_sal
      8              ,NVL(MAX(DECODE(mon,'C',sal)),0) current_sal
      9              ,NVL(MAX(DECODE(mon,'P',sal)),0)- NVL(MAX(DECODE(mon,'C',sal)),0)
    10                var
    11  FROM tbl
    12  GROUP BY empid          
    13               ;
         EMPID PREVIOUS_SAL CURRENT_SAL        VAR
             1          650         500        150
             2          100           0        100
             3          100         180        -80

  • PL/SQL problem in portal

    hello all,
    PROBLEM :
    I followed this thread Copying data from one field to another on a form
    but unfortunately..encountered with d following error...
    Any PL/SQL coding is throwing such errors on my portal..
    I have to install any additional tools or configure something..( I done executed the provsyns.sql for myschema)
    Someone please suggest me..
    ERROR :
    Internal error (WWC-00006)
    An unexpected error occurred: ORA-01001: invalid cursor (WWV-16016)
    Error displaying form : ORA-01001: invalid cursor (WWV-16408)
    Error running user PL/SQL code: ORA-01001: invalid cursor (WWV-16403)
    ORA-06550: line 5, column 7:
    PLS-00201: identifier 'P_SESSION.GET_VALUE_AS_VARCHAR2' must be declared
    ORA-06550: line 5, column 1:
    PL/SQL: Statement ignored
    ORA-06550: line 8, column 9:
    PLS-00201: identifier 'P_SESSION.GET_VALUE_AS_VARCHAR2' must be declared
    ORA-06550: line 8, column 1:
    PL/SQL: Statement ignored
    ORA-06550: line 11, column 1:
    PLS-00201: identifier 'P_SESSION.SET_VALUE' must be declared
    ORA-06550: line 11, column 1:
    PL/SQL: Statement ignored
    ORA-06550: line 15, column 1:
    PLS-00201: identifi (WWV-11230)
    Failed to parse as PORTAL_PUBLIC - BEGIN declare
    id varchar2(20);
    name varchar2(20);
    begin
    id := p_session.get_value_as_VARCHAR2(
    p_block_name => 'DEFAULT',
    p_attribute_name => 'EMP_ID');
    name := p_session.get_value_as_VARCHAR2(
    p_block_name => 'DEFAULT',
    p_attribute_name => 'EMP_NAME');
    p_session.set_value(
    p_block_name => 'DEFAULT',
    p_attribute_name => 'ID',
    p_value => id);
    p_session.set_value(
    p_block_name => 'DEFAULT',
    p_attribute_name => 'NAME',
    p_value => name);
    end; END; (WWV-08300)
    The preference path does not exist: ORACLE.WEBVIEW.PARAMETERS.1668713167 (WWC-51000)
    Many Thanks In Advance :-)

    hi Pappu
    if you have used the same exact code as given in the message you have mentioned, then please correct one variable's name. the reply I gave in that thread has a typo. in suggesting a solution to that question, I had tried it with a different set of variables on my system and in replying back, i mistakenly left one such variable in that thread.
    try it and see if you still get errors.
    AMN
    declare
    v_address1 varchar2(20);
    begin
    v_address1 := p_session.get_value_as_VARCHAR2(
    p_block_name => 'DEFAULT',
    p_attribute_name => 'A_ADDRESS1');
    p_session.set_value(
    p_block_name => 'DEFAULT',
    p_attribute_name => 'A_LOCATION1',
    p_value => v_address1);
    end;

  • PL/SQL- Problem in creating a partitioned fact table using select as syntax

    Hi All,
    I am trying to create a clone(mdccma.fact_pax_bkng_t) of existing fact table (mdccma.fact_pax_bkng) using dynamic pl/sql. However, pl/sql anonymous block errors out with following error:
    SQL> Connected.
    SQL> SQL> DECLARE
    ERROR at line 1:
    ORA-00911: invalid character
    ORA-06512: at "SYS.DBMS_SYS_SQL", line 1608
    ORA-06512: at "SYS.DBMS_SQL", line 33
    ORA-06512: at line 50
    Here is pl/sql block:
    -- CREATING FPB_T
    DECLARE
    v_owner VARCHAR2(32) := 'MDCCMA';
    v_table_original VARCHAR2(32) := 'FACT_PAX_BKNG';
    v_table VARCHAR2(32) := 'FACT_PAX_BKNG_T';
    v_tblspc VARCHAR2(32) := v_owner||'_DATA';
    CURSOR c_parts IS SELECT TABLESPACE_NAME, PARTITION_NAME,HIGH_VALUE, ROW_NUMBER() OVER (ORDER BY PARTITION_NAME) AS ROWNUMBER
    FROM USER_TAB_PARTITIONS
    WHERE TABLE_NAME = v_table_original
    ORDER BY PARTITION_NAME;
    v_cmd CLOB := EMPTY_CLOB();
    v_cmd3 varchar2(300) := 'CREATE TABLE ' ||v_owner||'.'||v_table||' TABLESPACE '||v_tblspc
    ||' NOLOGGING PARTITION BY RANGE'||'(' ||'SNAPSHOT_DTM '||')' ||'(';
    v_part VARCHAR2(32);
    v_tblspc_name VARCHAR2(32);
    v_row number;
    v_value LONG;
    v_tmp varchar2(20000);
    v_cur INTEGER;
    v_ret NUMBER;
    v_sql DBMS_SQL.VARCHAR2S;
    v_upperbound NUMBER;
    BEGIN
    v_cmd := v_cmd3;
    OPEN c_parts;
    FETCH c_parts INTO v_tblspc_name, v_part,v_value, v_row;
    WHILE c_parts%FOUND
    LOOP
    IF (v_row = 1) THEN
    v_tmp := ' PARTITION '||v_part||' VALUES LESS THAN ' ||'('|| v_value||')'||' NOLOGGING TABLESPACE '||v_tblspc_name;
    ELSE
    v_tmp := ', PARTITION '||v_part||' VALUES LESS THAN ' ||'('|| v_value||')'||' NOLOGGING TABLESPACE '||v_tblspc_name;
    END IF;
    v_cmd := v_cmd || v_tmp;
    -- DBMS_OUTPUT.PUT_LINE(v_cmd);
    FETCH c_parts INTO v_tblspc_name, v_part,v_value, v_row;
    END LOOP;
    -- DBMS_OUTPUT.PUT_LINE('Length:'||DBMS_LOB.GETLENGTH(v_cmd));
    v_cmd := v_cmd||')'||' AS SELECT ' || '*'||' FROM ' || v_owner||'.'|| v_table_original ||' WHERE '||'1'||'='||'2'||';';
    v_upperbound := CEIL(DBMS_LOB.GETLENGTH(v_cmd)/256);
    FOR i IN 1..v_upperbound
    LOOP
    v_sql(i) := DBMS_LOB.SUBSTR(v_cmd
    ,256 -- amount
    ,((i-1)*256)+1 -- offset
    END LOOP;
    v_cur := DBMS_SQL.OPEN_CURSOR;
    DBMS_SQL.PARSE(v_cur, v_sql, 1, v_upperbound, FALSE, DBMS_SQL.NATIVE);
    v_ret := DBMS_SQL.EXECUTE(v_cur);
    CLOSE c_parts;
    DBMS_OUTPUT.PUT_LINE(v_cmd);
    -- EXECUTE IMMEDIATE v_cmd ;
    END;
    The above pl/sql creates a DDL for partitioned fact table(new) based on an existing fact table and get executes through CLOB.
    Please look into the issue and let me know any changes or modifications/suggestions that are required to fix the issue. Any help is appreciated.
    Thank You,
    Sudheer

    Think this is your problem:
    v_cmd := v_cmd||')'||' AS SELECT ' || '*'||' FROM ' || v_owner||'.'|| v_table_original ||' WHERE '||'1'||'='||'2'||';';Remove the SQL terminator ';' ... dynamic SQL doesn't require it, try this instead:
    v_cmd := v_cmd||')'||' AS SELECT ' || '*'||' FROM ' || v_owner||'.'|| v_table_original ||' WHERE '||'1'||'='||'2';Thanks
    Paul

  • SQL problem

    I've got a problem with a servlet I'm writing. Here's a code snippet:
    if(operation.equals("Lookup details"))
              {     //get customer details
                   String Hnum = req.getParameter("HouseNum");
                   String Pcode = req.getParameter("PostCode");
                  String sql = "SELECT * FROM Customer WHERE house_num = " Hnum " AND postcode = '" Pcode "'";
                  String url = "jdbc:pointbase:server://localhost:9092/projectdb";
                  Connection con;
                  Statement stmt;
                  ResultSet rs;
                   try {
                        Class.forName("com.pointbase.jdbc.jdbcUniversalDriver");
                   catch(ClassNotFoundException ex) {
                        out.println("Failed to find driver");
                   try {
                        con = DriverManager.getConnection(url, "PBPUBLIC", "PBPUBLIC");
                        stmt = con.createStatement();
                        //execute query
                        rs = stmt.executeQuery(sql);
                   catch(SQLException ex) {
                        out.println("SQL Exception");
                        out.println("" + ex);
              }When it comes to actually executing the sql command I get the following error:
    SQL Exception
    java.sql.SQLException: Expected to find "end of SQL command" instead found "POSTCODE" at position 46.
    I can't quite see whats wrong with my SQL string, its probably something simple tho. Any ideas?

    For sure (200%) your request does not contain HouseNum parameter.
    You should check presence of HouseNum parameter for instance like:
    String hnum=req.getParameter("HouseNum");
    if(hnum==null || hnum.trim().length()==0)
       //do something here - for instance put default HouseNum value like:
       hnum="1"
    }

  • Sql Problems, Same Field Names In Multiple Mysql Tables?

    I have a keyword search that searches multiple DB tables for thumbnail images using UNION ALL. I have two pages, results.php, and view.php.  My goal is to able to click a thumbnail image on results.php and be directed to a larger version of that same image on view.php. The problem is each image in all my tables uses the field name "id" so when I click a thumbnail on results.php I get two different images with the same id from different tables.  I tried changing the id's to different names, but when it was time to pass url parameters I can only choose 1 value. (if you can choose more than 1 I don't know how).  So my question is why are my id's from different tables being grouped together, and how can I change this?
    Image Results Page (which works perfect):
    SELECT *
    FROM table1
    WHERE keyword LIKE %colname% OR id  LIKE %colname% 
    UNION ALL
    SELECT *
    FROM table2
    WHERE keyword LIKE %colname% OR id  LIKE %colname% 
    View Image Page (having problems here):
    SELECT *
    FROM table1
    WHERE id = colname
    UNION ALL
    FROM table2
    WHERE id = colname

    Yes, that is going to be a problem - and it's just the beginning of your problems when you do not normalize your data. Your data model is not correct. You should not be storing similar data in 15 tables - it's a really big mistake.
    To solve your current problem you would need to include a table identifier in the query results in the Image results page, and pass that to the view page and then use PHP to dynamically create the SQL with the correct table....ugh!

  • Java.sql problem

    Hi,
    I have a problem with "import java.sql.*".
    When a try to compile i get the error:
    "package java.sql does not exist"
    I've tried everything, classpath, add JAR/Libraries, install CDC tools, looked into hundred forums and can't solve the problem.
    I'm using NetBeans 5.5 with Mobility Pack.
    If anybody have any idea about what can I do, I'll appreciate it a lot.
    Thank You!
    If you need me to be more specific, please let me know

    I just start the application with
    import java.sql
    an then the rest of the applicationIf you want to import all the classes from the java.sql package, the correct import statement is:import java.sql.*;� {�                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Oracle-PHP PL/SQL Problem

    Dear,
    I have this situation:
    Inside PHP I call this statement:
    $usr_stmt = oci_parse($conn, "begin PKG_USERBEHEER_TEST.user_insert(PKG_USERBEHEER_TEST.user_create_type(:usr_id,:usr_naam,:usr_vnaam,:usr_email,:usr_pass,SYSDATE,NULL),:p_exusr_id); end;");
    binding the variables
    oci_bind_by_name($usr_stmt, ':usr_id', $USR_ID);
    oci_bind_by_name($usr_stmt, ':usr_naam', $USR_NAAM);
    oci_bind_by_name($usr_stmt, ':usr_vnaam', $USR_VNAAM);
    oci_bind_by_name($usr_stmt, ':usr_pass', $USR_PASS);
    oci_bind_by_name($usr_stmt, ':usr_email', $USR_EMAIL);
    oci_bind_by_name($usr_stmt, ':p_exusr_id', $EXEC);
    INSIDE MY PACKAGE:
    FUNCTION user_create_type(usr_id users.usr_id%TYPE, usr_naam users.usr_naam%TYPE, usr_vnaam users.usr_vnaam%TYPE, usr_email users.usr_email%TYPE, usr_pass users.usr_pass%TYPE, usr_start_datum users.usr_pass%TYPE, usr_eind_datum users.usr_eind_datum%TYPE) return user_rec is
    v_rec user_rec;
    Begin
    v_rec.usr_id := usr_id;
    v_rec.usr_naam := usr_naam ;
    v_rec.usr_vnaam:=usr_vnaam;
    v_rec.usr_email:=usr_email;
    v_rec.usr_pass :=usr_pass;
    v_rec.usr_start_datum := usr_start_datum;
    v_rec.usr_eind_datum := usr_eind_datum;
    return v_rec;
    end user_create_type;
    PROCEDURE user_insert(r IN OUT user_rec, p_exusr_id IN users.usr_id%TYPE) IS
    BEGIN
    --check if allowed
    IF(NOT checkallowedactions(p_exusr_id, 117)) THEN
    raise_application_error(-20999, 'User is not allowed executing this action');
    END IF;
    --end check if allowed
    SELECT seq_users.nextval
    INTO r.usr_id
    FROM dual;
    SELECT sysdate
    INTO r.usr_start_datum
    FROM dual;
    INSERT
    INTO users(usr_id, usr_naam, usr_vnaam, usr_email, usr_pass, usr_start_datum)
    VALUES(r.usr_id, r.usr_naam, r.usr_vnaam, r.usr_email, cryptit.encrypt(r.usr_pass), r.usr_start_datum);
    END user_insert;
    When I excecute my statement I get this error:
    Warning: oci_execute() [function.oci-execute]: ORA-06550: line 1, column 39: PLS-00363: expression 'PKG_USERBEHEER_TEST.USER_CREATE_TYPE' cannot be used as an assignment target ORA-06550: line 1, column 7: PL/SQL: Statement ignored in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\add_user.php on line 22
    But I need the out parameter, because I need my generated ID (Sequence) for futher use in my script.
    I'm not able to edit the pl/sql script because an other application is using it.
    Somebody can help me?
    Thx
    Davy

    The call to PKG_USERBEHEER_TEST.user_insert needs to pass a single PL/SQL variable as the first argument so that user_insert can return an update record. The OUT declaration of 'r' in user_insert is throwing the error. To that point, the problem is not due to PHP. You would get the same error in SQL*Plus.
    But, because you can't bind a record in PHP, you need to create a new PL/SQL function that calls PKG_USERBEHEER_TEST.user_create_type putting the returned record into a PL/SQL variable, and then calls user_insert. PHP would call the wrapper PL/SQL function.
    -- cj

  • Report SQL problem

    hi all,
    need some help in oracle report 6i, I have a SQL statement like
    SQL> select p.person_id, p.person_name, p.birth_date,max(cg.effective_start_date) "Last Concession",
    add_months(max(effective_start_date),24) "Next Concession"
    from person p, conc_given cg
    where p.person_id = cg.person_id
    group by p.person_id, p.person_name, p.birth_date
    p.person_id p.person_name p.birth_date Last Concession Next concession
    1234 peter scott 01/06/1967 05/07/00 05/07/02
    1489 smith bratt 09/04/1958 07/10/01 07/10/03
    The p.person_id I am selecting in my SQL statement do have some relationship
    with some other non-clients. Its all in relationship table...and person_id is a foreign key in that table..
    I want the results like as follows:
    p.person_id p.person_name p.birth_date relationship.person_id related person_name Last Concession Next concession
    1234 peter scott 01/06/1967 05/07/00 05/07/02
    1584 anita scott 07/09/01 07/09/03
    1897 david scott NULL NULL
    1489 smith bratt 09/04/1958 07/10/01 07/10/03
    1354 sonia bratt 09/06/1998 09/06/2000
    I can attach the related person_ID and his name with the p.person_id but the problem I am having
    I don't know how the relationship_ID and name can appear in the next line and their conc_dates as well...
    pls help
    Thanks

    Hi,
    Please run this sql statement in the SQL session. This way you will get the line number where the problem is happening.
    The error seems to be because the column in the select is not in the group by clause.
    Thanks,
    Sharmila

  • SQL problem with JSP

    In sql statements with JSP. Heres the deal:
    Access database:
    Tablename: EVENT
    FieldName: event_id
    DataType: Number
    I want to compare the event_id to an integer variable called "var" in a WHERE clause in an SQL statement through a JSP.
    String query = "SELECT * FROM EVENT WHERE EVENT.event_id = 'var' ";
    It says "Data type mismatch in criteria expression."
    Any Suggestions? I thought this should be straight forward! am i missing something?

    if i am reading correctly "var" is an int variable correct? If this is the case then the following will work;
    String query = "SELECT * FROM EVENT WHERE EVENT.event_id = " + Interger.toString(var) ;
    Hope that helps ( and i hope i read your problem correctly)

  • Reports Printing Dupes but not a SQL Problem

    I have a query that is not linked to any other query or group in my Data Model view. I ran the same query in TOAD and the correct results printed, however, when, I put the same query in the Data Model view it prints dupes. I have a repeating frame around the columns so that the entire recordset will print. Has anyone ever seen this before? I do not know what to look at because the SQL is running fine agains the database and there are no links that could cause the data output to have problems. There are multiple frames with separate queries, but they are not above and under this particular group. This group is the only one that is printing dupes. The frames are not overlapping or anything like that.

    Every group can have 3 lines only;
    Length(Detail01:A000001)<=16
    indicate:
    select Length('Detail01:'||'A000001') into d_len_1 from dual;
    d_len_1 must <=16
    Length(Detail02:A0002 A00003)<=22
    indicate:
    select Length('Detail02:'||'A0002'||' '||'A00003') into d_len_2 from dual;
    d_len_2 must <=22
    Length(Detail03:A00004 A00005)<=22
    indicate:
    select Length('Detail03:'||'A00004'||' '||'A00005')<=22 into d_len_3 from dual;
    d_len_3 must <=22
    Every record in this table can be used for one times;

Maybe you are looking for