Test Query before executing

Hello everyone,
I am write my final exam and I have to use oracle as the database and php as the GUI - programming - language.
Image this situation:
- Webform with 3 Textfields (names are a,b,c)
I have a table let's say mydata
mydata | value1 | value2 | value3
And I have defined some integrities like
value1.length >= 5
value2.length <= 5
value3.length >= 5 and value3.length <= 10
Now I want as soon sobody presses the submit button at the formular, the input-data should be checked. Right now I check them with PHP and as soon as an error occure, I return to the form with some error message.
I know, that is not the correct way, because if I check the data with PHP I don't need to create integrities at oracle.
Is there a way to check a query before exceuting? PHP creates three
querys, tests them all, and as soon there are no errors, then php calls the final
exceute querys.
My english is really bad, hopefully you get what I mean.
Thanks a lot
Hauke
PS.: I know I could update / insert all three values at the same time and it won't update / insert anything if one error occures, but in my program a form inserts / updates data from different tables at the same time
Message was edited by:
user584520

Hey,
so basicly what I what to do is to iterate through an array with sql - statements.
---- PHP ARRAY ----
update table1 set x=21 where id=1;
update table2 set y=333 where id=2;
---- PHP ARRAY ----
Now, I want to make sure, that all statements are correct for the oracle intergrity BEFORE the data will update.
In other words, all the querys should be tested and only if all tests are correct, then
it sould do the update - commands.
In case it's still not clear lets say you have a webform for changing your personal data. One field for your email-address and one for you lastname. I have oracle constraints to validate the email-address and another for validate the length of lastname. Also lets consider the email-address and lastname are not in the same table. What I have to do is something like
update CONTACTS set email='test' where id=1;
and
update ADDRESS set lastname='somebody' where id=1;
If I put both querys in one array and iterate thought it, the first element will cause an error because of the violation of constraints for email-address, the second one will be fine. So after iterating thought the array the lastname has changed, but the email is still the old one.
So the only way is the check all statements before executing them, but I have no idea if there is a possibility to do something like that.
Thanks again ;-)
Hauke

Similar Messages

  • Select the Key Figures to be presented in a query before execute the it

    Hi,
    I want to select(through checkbox) the Key Figures to be presented in a query before executing the query. I'm creating BEX queries and web templates (I'm working on BEX 7.0).
    I haven't found clear post about this so if you have implemented something like this please help me and share your solution.
    Kind regards,
    Ana

    Hi,
    If you set a property of your KF as "Hide and can be shown", you will get a filter option for these KFs after executing the report in the navigational block of web report.
    When you click on that filter, you will get the list of KFs, then you can select the desired KFs using check box.
    Regards,
    Yogesh.

  • Dynamically select Key Figures before executing web-based query

    Hi,
    I want to select(through checkbox) the Key Figures to be presented in a query before executing the query. The query is web-based.
    Has anybody an idea how to achieve this?
    Kind regards,
    Ton van Velzen

    You will need 2 templates.
    First one use the Checkbox item to list all the keyfigure structure elements, read the user selections using JavaScript, form the URL with the Filters for the key Figures and call the second template which will display the data.
    See the attached for passing filter values to BW Web templates.
    http://help.sap.com/saphelp_nw04/helpdata/en/59/edfe395dd76846e10000000a114084/content.htm

  • Executing PL-SQL Query before running a Report

    Hi Guys,
    Can i use a Run a Pl-Sql Query every time before executing a report. Like if i am opening a report then the pl-sql Query should run before it.
    Thanks
    Rondo.

    Try with Evaluate as one of the column's expression.. so that we can limit to specific report..
    or
    Use Connection Pool->Connection Pool Scripts tab->use 'Execute before query'
    Since we can set the repository variables using advanced tab.. the same variable we may validate using Connection pool scripts tab.
    This might be more dev work..
    Edited by: Srini VEERAVALLI on Dec 17, 2012 9:00 PM

  • How do I create a Snapshot without testing query?

    I'm working in an environment where the connection to the database server is done through a VPN that is sometimes broken and I have to wait for some time until it is restored. Other times, the database server is just down and in maintenance.
    In the meantime, I have to work with Director installed in a local virtual machine in my laptop.
    So, now I'm trying to develop some EDQ processes when there is no connection to the database, I'm unable to save snapshots because they require a test to occur (clicking in the Test button) before saving them, even if I'm providing a full SQL query to snapshot. I think it's because Director needs to know stuff like the data types of the columns to initialize properly the fields in the process.
    The problem is that I can't stop working just because there is no VPN. I should be able to create the processes and test them later when connection to the database is restored. I can do a lot of stuff (I can even copy-paste snapshots!) but I can't change nor create new ones, and that blocks me constantly.
    How can I do a snapshot save without database connection and have Director asking me the datatypes instead of trying to guess them from a "Test"?

    Hi,
    You can't create a snapshot without a connection to the database. A connection is needed when a snapshot definition is created in order to retrieve the column names and data types. As a solution to your problem, why not use data interfaces? Create a data interface that is of the required shape and refer to this in your processes (instead of the snapshot). You can then create mappings to different sources of data, e.g. snapshots, reference data, etc. You can test your processes when you're offline using a reference data mapping.
    regards,
    Nick

  • Variable screen doesnot appear when query is executed

    Hi All,
    We recently upgraded the BW 3.1 to 2004s(BI 7.0).
    When i am executing the query, the selection screen is not popping up.
    Instead the query is executing with default selection.
    I am facing problem when there are any mandatory fields.
    I appreciate your help,
    Thanks,
    Joseph.

    Hi,
    the variable is checked 'ready for input'
    it is used in a formula
    actually it is appearing for some users with BI_ALL auth,
    but were trying for some test users the variable screen is not appearing.
    even 'change variable value' to remove any personalization is not working from test user.
    and for BI_ALL users at change variable screen if we remove personilization, the following error is comming
    An exception with the type CX_SY_PROGRAM_NOT_FOUND occurred, but was neit     
    Program GP3T375QSSYZZ29YGQVGFUV7OO2 does not exist
    Thanks,
    Joseph

  • How to validate a Query without executing it?

    How to validate a Query without executing it?
    For example if I have:
    ReadAllQuery myQuery = new ReadAllQuery(myClass);
    myQuery.setSelectionCriteria(myExpression);
    What can I do to have must validation as possible been done before executing the query?
    Validation that could be done are:
    - Expression reference fields that really exist in TopLink mapping
    - Literal provided to expression are of compatible type
    - Parameter setting set against the query are all compatible

    Your could prepare the query.
    query.prepareCall(session, record);
    This will do all query validation and generate the SQL for the query.

  • QBE style(Find-Execute) Query not executing when VO has bind parameter

    I have an Entity Based ViewObject that is composed of 3 Entities so the entities are related through an Assoc. Then the ViewObject also has a bind paremeter defined and used in the WHERE clause.
    In my page everything is fine until when I use/click on the Find operation on the JSF page. When the Find operation is executed the page/form goes blank so I can enter by QBE query. Now when I Execute my search by executing the ExecuteWith params operation. Nothing is happening to the screen, it seems that query was not executed. Although there was no errors or exceptions displayed.
    However if I remove the bind parameter, and execute the Execute operation instead after going to Find mode, the query is executed properly and I get expected results.
    My problem is a bit general, but are there anyone who had a similar problem like this? Im still in the process of creating a test case.
    regards,
    Anton

    Hi Frank,
    But the "ExecuteWithParams" operation provides the bind variable right? (i had the value hardcoded on the pagedef). So it must have supplied a value. I also noticed that this is happening only when if the VIewObject contains two or more Entities. If the Viewobject has only 1 entity, the ViewObject queries properly.
    Anyway Frank, I had found a fix for this. I set an InvokeAction on the pagedef that binds to the ExecuteWithParams that is invoked during page load only(!postback condition). and then I just use the Find-Execute operations instead of the Find-ExecuteWithParams operations that I used previously.
    I will try to replicate the issue again to investigate what's really going on. I just want to know if its a bug or just an expected behavior or i just made a mistake.
    regards,
    Anton

  • No result returned or XML returned contains error in test query

    Hello,
    I have a problem with Visual Composer 7.0. When I try to execute a test query it shows the following error:
    'No result returned or XML returned in the result contains error'. What could it be?
    Thanks,
    Belen

    Either your query doesn't return results or you don't have the MSXML Parser installed on your client.

  • If bindParametersForCollection fires will a query definitely execute?

    Hi
    I have an ADF BC application written in Jdev 10.1.3. The user is reporting performance problems in one part of the application. We have a CustomViewObjectImpl which overrides the bindParametersForCollection method and outputs the following message
    System.out.println("### Executed Query here for View Object "+getFullName());This message is output 3 times indicating the view object query is executed 3 times. I have accounted for 2 of them but I can't for the life of me see why the VO query is executing a third time.
    I wondered if this message is accurate in saying that the VO query is executing when the bindParametersForCollection is fired?
    I put a message in the view objects class file. In the executeQueryForCollection method is
      String calling = new Throwable().fillInStackTrace().getStackTrace()[1].getClassName();
      System.out.println("called by <"+calling+">");This only fires once - before the first "Executed Query here for View Object".
    thanks
    paul schweiger

    I found what was causing the third execute query - there was a reference to #{bindings.WsWanalItemsView1Iterator.estimatedRowCount} in one of the items on the page.
    Am I right to presume that estimatedRowCount causes the same performance hit executing the view object's query?

  • Validate SQL string before executing

    I am attempting to find a way to validate an SQL script file before executing against a database. This is to allow any errors within the script to be identified and fixed before running against a pre-live / live database.
    These scripts may contain both DDL and DML.
    Is there any way to run the script and only have the changes visible to the current user, with all other database users unaffected until the changes have been checked (in a similar way to running an insert / update / delete without committing the changes)? Failing this, are there any tools to check the validity of the statements within an SQL script file?
    Any help with these or alternative solutions would be much appreciated.
    Cheers,
    Steve

    This is not sensible.
    How can you test a DML that creates a table (that does not create the physical table) and then test a DDL that uses that table that was not created and of which no record exist?
    The validity of a SQL statement (DML or DDL) depends on numerous factors, including the state of the database at that specific point in time that it is being run. You may test/check a DML that creates an index and it is fine.. until run on production where it times out as it cannot get a lock on the table in order to create the index.
    Or there is insufficient free space in the tablespace to build the index. Or the index is build in parallel and one of the PQs fail because on an Oracle bug, resulting in the complete DDL failing.
    Etc. Etc.
    If the intention is to be able to test an upgrade/patch/install script for a production database for every single potential problem and error, and then have a 100% guaranteed success rate in running that on production.. er.. excuse me for a moment..
    <mad laughter heard from outside>
    Er.. okay. Back again.
    This will need - no compromises and just for starters - the exact same h/w platform, o/s, Oracle s/w, and duplicated production database (cloned perhaps) as the test platform.
    And if this is not possible or feasible then you should forget about having that script tested in such a fashion in order to have a 100% guarantee of a successful production deployment... and investigate the optimum method to test as far as possible, and build a comprehensive plan for change management and dealing with problems out of this upgrade, on production.

  • How can I set a password for firefox so that everyone have to enter the password before executing firefox

    My younger sister executed my firefox just at this afternoon(she originally use IE), and she saw something that can't be seen. How can I set a password for firefox so that everyone have to enter the password before executing firefox?

    Also see this for an English version of Profile Password:
    *Profile Password: http://nic-nac-project.de/~kaosmos/profilepassword-en.html#PPF
    It is an extension to protect the profile with a password, but being an extension that protection can easily be bypassed by starting Firefox in [[Safe mode]].<br />
    So do not rely on it.<br />
    If you want to protect content then you have to use methods supported by the OS like a separate user account with a password or an encrypted file system.

  • How to ignore a variable defined in a query when the query gets executed

    Hi SAP guru, I am creating a query, which has a user input variable, say A, and a replacement path variable, say B, Bu2019s value is determined by A and the whole purpose of A is letting user entering an initial value and A must be ignored when the query gets executed. How can I achieve this in query designer?
    Thanks

    Hi, thanks for the reply. Actually this is not my problem. My problem is the query should be filtered by  a variable, say B, but B is not allowed to be entered directly by user (i.e. B could be a replacement path variable or user exit type). So B has to be derived from another user input variable, say A. However if I defined A in the query, A is by default used as one of the filters, which is not desirable because A is a subset of B in my case and should be ignored.
    Is there options (settings) that allow the query ignore a specified variable (A) ? If not is there other ways to get around this?
    Thanks
    MichScott

  • How can i do a variable User exit that present the values before execute

    Hi Gurus,
    How can i do a variable User exit that present the values before execute, i need this:
    a variable that calculate SYS-DATUM until 30 days before (I got the code) but this  variable run automatic because is user exit, i want this variable but first present the values, not execute automatic, this is because the users want the report that automatic present the values , help

    Hi,
    Refer the below links,
    http://documentation.softwareag.com/natural/nat424mf/pdf/ops_mf/conf_usrex.pdf
    http://www.erpgenie.com/component/content/article/1097
    http://www.apentia-online.at/UP/Apentia/files/Article/SAP_BW_User_Exits_and_BAdIs.pdf
    Hope it helps you,
    Regards,
    Ravindra.

  • SQLException: After clearParameters() has been called, all parameters must be reset before executing

    Hi,
    I am running: Weblogic 6.1, SP2
    Driver : weblogic.jdbc.oci.Driver
    Reason for not using the "thin" driver, which works, is limit
    on size of Clob
    Previous references to this problem in this newsgroup indicate driver problems
    with older versions of WL.. I am using the latest..
    The SQLException I get is "After clearParameters() has been called, all parameters
    must be reset before executing". This happens the second time the code below is
    excuted ( ok the first time )
    "clearParameters()" is never called explicitly in my code.
    The exception occurs on the "spFunc.execute();" statement at the very end of this
    code:
    // OBS:connection, conn_, is opened from a connection pool
    before this code is called and cloesed afterwards.
    conn_.setAutoCommit(false);
    // ============== Initializing clob ==================
    SerialStatement stmt = (SerialStatement)conn_.createStatement();
    stmt.execute("INSERT INTO lc_clob_temp VALUES (1, EMPTY_CLOB())");
    // OBS: using a prepared statement here will result in SerialClob
    // exception when using setClob in the prepared statement
    below
    // This is probably a bug ( worked in WL 5.1 ). We had this
    as a support case 270952 with WebLogic.
    stmt.execute("SELECT * FROM lc_clob_temp WHERE id = 1");
    ResultSet crs = stmt.getResultSet();
    weblogic.jdbc.rmi.SerialClob xmlClob = null;
    while ( crs.next() ) {
    xmlClob=(weblogic.jdbc.rmi.SerialClob)crs.getClob("newclob");
    // Call Oracle's stored procedure for calling Oracle XSU.
    SerialCallableStatement spFunc =
    (SerialCallableStatement)conn_.prepareCall(
    "declare " +
    "insCtx sys.DBMS_XMLSave.ctxType; " +
    "begin " +
    "insCtx := sys.DBMS_XMLSave.newContext(?); " +
         "sys.DBMS_XMLSave.setBatchSize(insCtx,0);" +      "sys.DBMS_XMLSave.setCommitBatch(insCtx,
    0);" +
    "? := sys.DBMS_XMLSave.insertXML(insCtx,?); " +
    "sys.DBMS_XMLSave.closeContext(insCtx); " +
    "end;"
    spFunc.setString(1, viewName );
    spFunc.registerOutParameter (2, Types.NUMERIC);
    Writer outstream = xmlClob.getCharacterOutputStream();
    outstream.write(xml.toString());
    outstream.flush();
    outstream.close();
    spFunc.setClob( 3, xmlClob);
    spFunc.execute();
    spFunc.close();

    Hi,
    I am running: Weblogic 6.1, SP2
    Driver : weblogic.jdbc.oci.Driver
    Reason for not using the "thin" driver, which works, is limit
    on size of Clob
    Previous references to this problem in this newsgroup indicate driver problems
    with older versions of WL.. I am using the latest..
    The SQLException I get is "After clearParameters() has been called, all parameters
    must be reset before executing". This happens the second time the code below is
    excuted ( ok the first time )
    "clearParameters()" is never called explicitly in my code.
    The exception occurs on the "spFunc.execute();" statement at the very end of this
    code:
    // OBS:connection, conn_, is opened from a connection pool
    before this code is called and cloesed afterwards.
    conn_.setAutoCommit(false);
    // ============== Initializing clob ==================
    SerialStatement stmt = (SerialStatement)conn_.createStatement();
    stmt.execute("INSERT INTO lc_clob_temp VALUES (1, EMPTY_CLOB())");
    // OBS: using a prepared statement here will result in SerialClob
    // exception when using setClob in the prepared statement
    below
    // This is probably a bug ( worked in WL 5.1 ). We had this
    as a support case 270952 with WebLogic.
    stmt.execute("SELECT * FROM lc_clob_temp WHERE id = 1");
    ResultSet crs = stmt.getResultSet();
    weblogic.jdbc.rmi.SerialClob xmlClob = null;
    while ( crs.next() ) {
    xmlClob=(weblogic.jdbc.rmi.SerialClob)crs.getClob("newclob");
    // Call Oracle's stored procedure for calling Oracle XSU.
    SerialCallableStatement spFunc =
    (SerialCallableStatement)conn_.prepareCall(
    "declare " +
    "insCtx sys.DBMS_XMLSave.ctxType; " +
    "begin " +
    "insCtx := sys.DBMS_XMLSave.newContext(?); " +
         "sys.DBMS_XMLSave.setBatchSize(insCtx,0);" +      "sys.DBMS_XMLSave.setCommitBatch(insCtx,
    0);" +
    "? := sys.DBMS_XMLSave.insertXML(insCtx,?); " +
    "sys.DBMS_XMLSave.closeContext(insCtx); " +
    "end;"
    spFunc.setString(1, viewName );
    spFunc.registerOutParameter (2, Types.NUMERIC);
    Writer outstream = xmlClob.getCharacterOutputStream();
    outstream.write(xml.toString());
    outstream.flush();
    outstream.close();
    spFunc.setClob( 3, xmlClob);
    spFunc.execute();
    spFunc.close();

Maybe you are looking for

  • Recover Undo Segment

    Hi, I am getting the following error in Alert Log file. SMON: about to recover undo segment 4 SMON: mark undo segment 4 as needs recovery SMON: about to recover undo segment 7 SMON: mark undo segment 7 as needs recovery Can any buddy tell us that how

  • Photo Booth Pop Art Issues

    Having problems with pop art on photo booth. All software is current versions, but not sure when it wet funny. Usually pop art setting gives you the four coloured screens, I currently get one red section with an image with the other 3 screens yellow.

  • SHMA - Shared Objects

    hi folks, we're using shared objects and are wondering how it could be easily achieved to build the "sharded objects" automatically on ALL !!!! application-server, or do we have to start the build-programs per each server manually ???? kind regards,

  • Call Manager forwarding alerts

    Hello. Does anyone know of any integrations between Cisco Call Manager and other network mgmt platforms like HPOpenView NNM or Ciscoworks? Can Call Manager send alerts to other Network Management platforms?

  • I keep getting kicked off facebook

    my ipod keeps kicking me off facebook