Question about handling apostrophe in the stored procedure parameter

I was wondering how people have dealt with this problem.  In my process I use the operation to execute stored procedure (sp) to write data to a database, and it is by the way the field values to the sp as parameters.  Works fine when everything is normal but as soon as an apostrophe is added in one of the fields, ka-boom.  It breaks .  So I have been messing around with the means to fight against this problem and did not really come wih an appropriate option.  I know that I can go on the form and write a few RegEx and change the single apostrophe double that would work, but I have to write in several events since the form is sent to someone else and I can't have them seeing "clerk"s"instead of"clerk".  Right now I'm writing an xpath statement that would replace the single apostrophe with a double bed with no luck.  I was wondering if anyone else has had this problem and found an easy solution.  Thank you

Mike

Why not use the parameterized query option.

In this way, your settings are replaced by some? and you don't get messed up with the '

Your select statement would look like: select * from table where column1 =? and column2 =?

Then you can map the? s in the process variables.

Jasmine

Tags: Adobe LiveCycle

Similar Questions

  • How to pass the content of the table as OUT of the stored procedure parameter

    Hi all

    I am writing a stored procedure where he must accept date as one of the parameters IN and it must interrogate the table of database on this criterion and should address data in a temporary table.

    in the end, he must send all the data from the temporary table as the OUT parameter.

    How to get there? should I create a new TYPE with all the columns in the Temp table and use this Type as a parameter? or SYS_REFCURSOR is the best option.

    Thanks in advance.

    Hello

    The best way to do what you want depends on what you want.  Start by describing what you need to do.  It is best to post some data examples (CREATE TABLE and INSERT statements), and what results you want from this sample data.  (See the FAQ forum: https://forums.oracle.com/message/9362002)

    If you have any ideas on how to do the work (for example, populating a temporary table) it may be useful to include those who, too, but a clear distinction between WHAT you do and HOW you do it.

    Bencol suggested, a SYS_REFCURSOR may be the best way to transmit the results.

    Since you only post your table, or even describe what you wanted to do with it, I will illustrate using scott.emp, which is probably on your system.

    Say you want a procedure that takes a DATE as an argument, then returned a certain designated columns (empno, ename, and hiredate in the example below) for all employees hired from the given DATE.  You can write a procedure like this:

    CREATE OR REPLACE PROCEDURE hired_since

    (IN start_date DATE

    out_data ON SYS_REFCURSOR

    )

    AS

    BEGIN

    OPEN FOR Out_data

    SELECT ename, empno, hiredate

    FROM scott.emp

    WHERE hiredate > = start_date;

    END hired_since;

    /

    DISPLAY ERRORS

    You can test it in SQL * more like this:

    VARIABLE c REFCURSOR

    EXEC hired_since (DATE ' 1982-01-01',: c);

    PRINTING: c

    The output I received this test was:

    ENAME, EMPNO, HIREDATE

    ---------- ---------- ---------

    7788 SCOTT APRIL 19, 87

    7876 ADAMS MAY 23, 87

    7934 MILLER JANUARY 23, 82

  • Call to the stored procedure parameter passing script

    Hello

    I have a database on linux server. On the same server, there is a shell script which takes 3 parameters.

    Now I want to do a procedure (stored procedure) that will have 3 parameters pass and run this script with these settings.

    I had created object directory pointing to the correct directory granted all privileges on it (I hope).

    Now, I wondered how the code of procedure?

    I also did a program within the database which takes 3 parameters, but I don't know how to operate it. I don't know if I can use work to run the program, because

    It is a multi user thing and I think that this will not work as expected if 2 or more users run it.

    In any case, I was hoping that I can solve this problem by creating the procedure that will run the script that is provided with 3 parameters, that I need.

    I hope I'm clear on what I want to do.

    Please if you have an idea how to Edifier post your ideas.

    Thank you!

    Hello

    first I want to thank you for the reply.

    option 1... I don't want not to use java or c because I have no skills in programming languages.

    option 2 you mentioned dbms_scheduler.

    If I understand the procedure should go like that.

    I create whitin database program. Then I create a job which runs this program. And whenever I want to run my shell script, I'll do the work.

    WHA happen if 2 different users will want to run the script at the same time?

    Thank you for your response.

  • Handling exceptions in the stored procedure, loop IF... ON THE OTHER

    Hello guys,.
    We want to put in the exception handling in the loop, but get the following error:

    Error (43.3): PLS-00103: encountered the symbol "EXCEPTION" when expecting one of the following values: begin case declare end exit for goto rise back loop mod null pragma select update while < ID > < one between double quote delimited identifiers of > < a variable binding > < < close current delete fetch locking open insert commit rollback savepoint SQLExecute fusion forall hose set


    create or replace
    Xxxx PROCEDURE
    FOR IN MESSSY
    (
    Select i.
    FROM x I have

    )
    LOOP

    Upper IF (CODE) = 'n' THEN
    INSERT INTO T_MESS (MP)
    (
    Select I.MP_ID
    OF T_ME
    );
    Upper ELSIF (MESSSY.k2) = 'L' THEN
    DELETE T_MESS WHERE T_MESS. MP = MESSSY. MP;
    END IF;
    EXCEPTION
    WHEN DUP_VAL_ON_INDEX THEN
    A program attempted to insert duplicate values in a column that is constrained by a unique index.
    DBMS_OUTPUT. Put_line ("a program attempted to insert duplicate values in a column that is constrained by a unique index.")
    -No Rollback
    END;
    COMMIT;
    END LOOP;
    END xxxx;


    is - anyone know why?

    There are few changes needed in your code to compile successfully.

    Take a look at the following code. I pointed out the changes made by me with stars to compile successfully.

    I hope this helps.

    CREATE OR REPLACE PROCEDURE xxxx
    *as*
    *begin*
    FOR messsy IN (SELECT i.* FROM dual i) LOOP
      *begin*
       IF upper(CODE)='N' THEN
       INSERT INTO T_MESS(MP)
       (
       select I.MP_ID
       FROM T_ME
       );
       ELSIF upper(MESSSY.k2)='L' THEN
       DELETE T_MESS WHERE T_MESS.MP = MESSSY.MP;
       END IF;
    
       EXCEPTION
    
       WHEN DUP_VAL_ON_INDEX THEN
    
       A program attempted to insert duplicate values in a column that is constrained by a unique index.
       DBMS_OUTPUT.PUT_LINE ('A program attempted to insert duplicate values in a column that is constrained by a unique index.')
       --No Rollback
       END;
    
       COMMIT;
    END LOOP;
    END xxxx;
    
  • Execution of the stored procedure Oracle EF6 error.

    Hello

    Need help with the oracle error

    {"ORA-06550: line 1, column 8:"}

    PLS-00306: wrong number or types of arguments in the call to "sp_name".

    ORA-06550: line 1, column 8:

    {"PL/SQL: statement ignored '}

    This error occurs when the code runs the line in Vb.net application in Model Designer

    MyBase.ExecuteFunction ("sp_name" para1, para2, para3, dOBpara4, para5)

    I create the SSDL and CSDL, MSL files for oracle to MS SQL connection by the method mentioned in the link JasonShort - professional profile - CodeProject it worked perfectly fine without the stored procedures. I managed to insert, update, and delete records. Then, I created stored procedures for Insert, Update, Delete. It worked fine with MS SQL. I copied and updated oracle files respectively. I gives me the error mentioned above.

    I executed stored procedures in Oracle SQL Developer, and it works without error. But when it is executed via the model there is light of the error. Can anyone let me know the solution for this error. I'm using VS2010, EF6, Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64 bit Production

    Thank you

    Prachin Soparkar

    Hello

    Sorry for the inconvenience. After I posted this question I took a break and saw that the error was nothing, but I had given FNAME as parameter name in MS SQL. In oracle when I created the sp I created the parameter with p_FNAME. Where the schema defined in the language SSDL and CSDL, MSL had to be changed to MS, but since I want to that it would be same in different databases, I choose to have changed it in oracle stored procedure. The error msg is confusing, it should be something not found parameter or incompatibility etc.

    Thank you

    Prachin Soparkar

  • Adding apostrophe in dymanic, stored procedure

    Hello world

    I use a stored procedure that prints the triggers which is called as a script to dynamic triggers.

    Here I store the values required in M_ALL_DYNAMIC_DRIVER_TEMP table name

    for ex: M_ALL_DYNAMIC_DRIVER_TEMP:

    TABLE-NAME DATA_UID_ALT1_PREFIX IU_TRG_FLAG

    --------------         --------------------------                  -------------

    BA_ORG                ALT                                     Y

    stored procedure is:

    create or replace

    PROCEDURE SP_TRIGGER_SCRIPT_temp

    AS

    SQLSTR VARCHAR (4000);

    SQLSTR_ETL VARCHAR (4000);

    SQLSTR1 varchar (40);

    SQLSTR2 varchar (40);

    SQLSTR3 varchar (40);

    SQLSTR4 varchar (40);

    Table-name varchar (40);

    PK_TABLE varchar (40);

    Start

    for c in (select TABLE_NAME, DATA_UID_ALT1_PREFIX from M_ALL_DYNAMIC_DRIVER_TEMP where IU_TRG_FLAG = 'Y' and DATA_UID_ALT1_PREFIX is not null)

    loop

    SQLSTR1: = c.TABLE_NAME;

    SQLSTR2: = TRIM (SQLSTR1) | ' _ID'.

    DBMS_OUTPUT. PUT_LINE ('-TABLE_NAME START :'||) SQLSTR1 |', DATA_UID_GEN_METHOD:ALT1, SHORT_TRG_BASENAME:-");"

    SQLSTR: = ' create or replace

    TRIGGER ' ' |. ' TRIM (SQLSTR1) | "' _IU_TRG ' INSERT BEFORE THE '. SQLSTR1 | "FOR EACH LINE

    BEGIN

    If the insertion

    If: new. ROW_CHANGED_BY is NULL then

    : new. ROW_CHANGED_BY: =: new. ROW_CREATED_BY;

    end if;

    If: new. DATA_UID is NULL then

    SELECT GENERATE_DATA_UID('||) SQLSTR1 |',: new.'. SQLSTR2 |') IN: new. DATA_UID FROM DUAL;

    end if;

    end if;

    If the update can

    If it isn't updating ("ROW_CHANGED_BY") then

    : new. ROW_CHANGED_BY: = USER;

    end if;

    end if;

    END ';

    DBMS_OUTPUT. PUT_LINE (SQLSTR);

    DBMS_OUTPUT. PUT_LINE (SQLSTR_ETL);

    DBMS_OUTPUT. PUT_LINE ('-END OF ' |) SQLSTR1 | » -------------------------------------------------------------');

    end loop;

    end;

    When I run the stored procedure out put:

    -LAUNCH TABLE_NAME:BA_ORG, DATA_UID_GEN_METHOD:ALT1, SHORT_TRG_BASENAME:-

    create or replace

    "BA_ORG_IU_TRG" TRIGGER BEFORE INSERT ON BA_ORG FOR EACH LINE

    BEGIN

    If the insertion

    If: new. ROW_CHANGED_BY is NULL then

    : new. ROW_CHANGED_BY: =: new. ROW_CREATED_BY;

    end if;

    If: new. DATA_UID is NULL then

    SELECT GENERATE_DATA_UID (BA_ORG,: new.BA_ORG_ID) INTO: new. DATA_UID FROM DUAL;

    end if;

    end if;

    end if;

    END

    --------------------------------------END OF BA_ORG-------------------------------------------------------------

    I want to:

    statement: SELECT GENERATE_DATA_UID (BA_ORG,:new.BA_ORG_ID) IN: new. DATA_UID FROM DUAL;

    be: SELECT GENERATE_DATA_UID ('BA_ORG',: new.BA_ORG_ID) INTO: new. DATA_UID FROM DUAL;

    That is to say, function GENERATE_DATA_UID ('BA_ORG',: new.BA_ORG_ID) first parameter I want apostrophe

    Please help on this

    SELECT GENERATE_DATA_UID ("' |) SQLSTR1 | ''',:new.' ||

    ----

    Ramin Hashimzade

  • Materialized view, based on the stored procedure

    Hi all

    is it possible to create a materialized view on the results returned by a stored procedure?

    If this is not the case, do you think that any other way except for filling a table with data from the stored procedure and then founded the MV on it?

    Thanks in advance.

    MichaelTsilikidis wrote:

    Sorry I don't speak properly. In fact the procedure does not return a value, it fills one of its parameters (of the ref cursor type) of data. That's what I wanted.

    No it's not.

    REF CURSOR don't store data, so it's not possible.

    A Ref cursor is just a pointer to a query... and you can't "select from" a ref cursor, you can retrieve only one open.

    PL/SQL 101: Understand the Ref Cursor

    As correctly stated above, you can't question from a procedure to a function, and a materialized view is based on a query, you cannot use a procedure in a materialized view.

    You could use a function pipeline instead of a procedure, or have the pipeline function obtain the results of the procedure and pipelines, and then the materialized view could be based on the results of this function in the pipeline.

    example of function pipeline:

    SQL > CREATE or REPLACE TYPE AS OBJECT num_descript (num number, descript varchar2 (30))
    2.

    Type of creation.

    SQL >
    SQL > CREATE or REPLACE TYPE tbl_num_descript AS TABLE OF THE num_descript
    2.

    Type of creation.

    SQL >
    SQL >
    SQL > CREATE or REPLACE PACKAGE AS-reftest
    2 FUNCTION pipedata (number p_choice) tbl_num_descript RETURN PIPELINED;
    3 END;
    4.

    Package created.

    SQL >
    SQL > CREATE or REPLACE PACKAGE BODY AS-reftest
    2 FUNCTION pipedata (number p_choice) tbl_num_descript RETURN PIPELINED IS
    3 v_obj num_descript: = num_descript (NULL, NULL);
    4 v_rc sys_refcursor;
    5 BEGIN
    6. IF p_choice = 1 THEN
    7 v_rc OPEN to SELECT empno as num, ename like descript FROM emp;
    8 ELSIF p_choice = 2 THEN
    9 OPEN v_rc to SELECT deptno as num, dname as descript OF THE Department;
    10 END IF;
    11 LOOP
    12 FETCH v_rc INTO v_obj.num, v_obj.descript;
    EXIT 13 WHEN v_rc % NOTFOUND;
    14 PIPE ROW (v_obj);
    15 END LOOP;
    16 v_rc NARROW;
    RETURN 17;
    18 END;
    END 19;
    20.

    Package body created.

    SQL > select * from table (reftest.pipedata (1));

    DESCRIPT NUM
    ---------- ------------------------------
    7369 SMITH
    7499 ALLEN
    7521 WARD
    7566 JONES
    7654 MARTIN
    7698 BLAKE
    7782 CLARK
    7788 SCOTT
    KING 7839
    7844 TURNER
    7876 ADAMS
    JAMES 7900
    7902 FORD
    7934 MILLER

    14 selected lines.

    SQL > select * from table (reftest.pipedata (2));

    DESCRIPT NUM
    ---------- ------------------------------
    10 ACCOUNTING
    SEARCH 20
    30 SALES
    40 OPERATIONS

  • user_table should be used in the stored procedure.

    Hello

    I want to find my permanent table user_tables and then drop and recreate it,

    I can use this user_tables in my stored procedure for above purpose or is there any notice that must be used.

    SP is admin sp, used to run in offline mode.

    yorus truly

    Published by: 944768 on 10 February 2013 23:44

    Published by: 944768 on 10 February 2013 23:44

    944768 wrote:
    but I wanted to know that can I use user_table in above proc stored to conclude and then drop and create it when Everitt runs?

    Oracle manages two "flavors" of the stored procedure - copyright and rights of the Summoner. Rights of the DEFINER (default) is always performed under stored security area of the owner of the procedure no matter who calls it. So, if you ask USER_TABLES (or any display USER_, besides) within DEFINER rights stored procedure, you will get a list of tables owned by the owner of the stored procedure, not stored calling procedure. Rights (AUTHID CURRENT_USER) stored Invoker procedure is always carried out under the domain of the calller security. Therefore, if you are querying USER_TABLES (or any display USER_, besides) within the Summoner rights stored procedure you will get a list of tables belonging to the appellant a stored procedure. Hope it answers your question.

    SY.

  • Key of the stored procedure

    Hello

    I have a function in the db that returns a numeric value after passing an Id (digital). How do I create a join in physical layer as funtion will return a digital and given that it is a function, it can return only a single column.

    is it possible that I can keep the id (parameter) in the phycisal layer which I'm passing to the function, so that I can join neccasy in the physical layer with fact/Sun to the stored procedure.

    is the possible creation of mutiple stored procedure in physics if my function to only return a single column.

    Concerning
    Issue

    If I understand your question, you have a function that returns a numerical value based on an ID, we'll call it Customer ID as a sample. What you need to do is to create a view like this:

    CREATE THE VIEW IN CIRCULATION
    SELECT CUSTOMER_ID, get_outstanding (CUSTOMER_ID) FROM CLIENT

    You can then query this view like this:

    SELECT * EXCEPTIONAL WHERE CUSTOMER_ID = 999

    You could also use this point of view in your physical layer and attach it by customer ID. If you already have a table of facts, you could put a top view to add the extra column with your function. It of all good and should work fine with a warning. PL/SQL execution on SQL functions is not effective. Oracle has switch context between SQL and PL/SQL for each line and change in context is an expensive operation. In a proper system of DWH you préremplira your fact table with the results of get_outstanding for all customers so that there is no delay in the calculation it when OBIEE queries data.

  • can I export and import my database to oracle via the stored procedure?

    Hi all

    I need to export my database using the stored procedure, the stored procedure is called by the java application and it works well
    Now I still get the "ULTIMATE QUESTION", could export and import the database using the stored procedure?

    Really thanks for the reply.

    Kind regards

    Kahlil

    Hello

    I think you can use DBMS_DATAPUMP (10.1 +), see [DBMS_DATAPUMP | http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28419/d_datpmp.htm#i1007277], for examples, see [http://www.psoug.org/reference/dbms_datapump.html]

    Kind regards

  • How can I transfer content from an XML file in a MS SQL database of the stored procedure using LabWindows/CVI SQL Toolkit?

    Hello

    I have a problem to transfer content to an XML file in a MS SQL database through a stored procedure data/fixed. I am able to transfer the content of the file using method...

    HSTMT = DBPrepareSQL (hdbc, EXEC usp_InsertReport " ... ");

    resCode = DBExecutePreparedSQL (hstmt);

    resCode = DBClosePreparedSQL (hstmt);

    ... but in this case, I am not able to read the return value of the stored procedure.

    I tried to follow the example of the stored procedure in the help documentation (DBPrepareSQL), but I miss a xml data type?

    No idea how to solve my problem?

    Cake of KR

    DianaS salvation,

    Thanks for your comments. During this time I found another way which fullfill my needs:

    resCode = DBSetAttributeDefault (hdbc, ATTR_DB_COMMAND_TYPE, DB_COMMAND_TEXT);

    sprintf (sz_SqlStatement, "DECLARE @TESTID INT EXEC @TESTID = usp_InsertReport ' SELECT 'RetVal' %s = @TESTID", sz_Buffer ");
    HSTMT = DBActivateSQL (hdbc, sz_SqlStatement);

    While ((resCode = DBFetchNext (hstmt)) == DB_SUCCESS)

    {

    / * Enter values in the record. */

    resCode = DBGetColInt (hstmt, 1, & s32_TestId);
    }

    resCode = DBDeactivateSQL (hstmt);

    sz_Buffer is the content of the XML file.

    Cake of KR

  • Call the stored procedure, and bind parameters by name

    Hello

    I use the Oracle ODBC 12 c driver to pass values from one Interface to our database Oracle 11.2. The Interface software collects data from modbus protocoll and calls a stored procedure. Right now my syntax to call the stored procedure looks like this:

    CALL procedure-name ('STRING', 'Timestamp as String', numValue1);

    It works very well. Now, I have to add a default setting to my procedure. To stay flexible to make other changes, I want to call the procedure and bind the parameters by name. Release 10.2.0.1.0 ISC ODBC Notes:

    Added support for the named parameter, binding the parameters by name. ODBC Oracle driver now allows the application to specify the parameters of a stored procedure by name, in the procedure call. Named parameters are to be used in calls to stored procedures and should not be used in other SQL statements.

    So, it shouldn't be a problem to use named notation, but how do I do this in ODBC? I tried like this, but oracle returns an ora-00936 error of missing expression:

    call procedure-name (paramName1 = > 'STRING',= paramName2 > 'Timestamp as String',paramName3 = > numValue1).


    Thank you for your help.

    Finally, I was able to find the error. The syntax of the statement was very good. The problem was caused by another declaration that I edited before and the error has not attracted Attention immediately.

    Thanks for reading and looking for an answer.

  • Block based on the stored procedure cannot modify Default_where clause

    Hi all

    I tried to create a block based on the stored procedure that it works very well with the result set for the refcursor. But if I need to add filters on the block using where clause in the palette of goods or

    using the property block set in where clause, it does not error but does not review filters .

    tried everything to you please let me know. This is a restriction whereby we can set filters on the block when we create the block based on the stored procedure.

    Thank you

    Check in Form Builder Help:

    Creating a block of data from a procedure that uses a ref cursor

    ... You can't pass a WHERE or ORDER BY clause clause in a stored procedure.

    But you can send your WHERE condition using the query Source Arguments.

    If the procedure is on the side of the database (not in the forms module), ensure that the procedure is not vulnerable to injection of SQL code.

    Kind regards

    Zlatko

  • How can I force DAC to run always full load for one of the task that executes the stored procedure? And remaining tasks load incremental in the second and sub sequent executions.

    Hello

    How can I force DAC to run always full load for one of the task that executes the stored procedure? And remaining tasks load incremental in the second and sub sequent executions.

    Thank you

    Jay.

    Hi if your task is running an informatica mapping you can set your DAC task to run the full mapping for incremental and full loads, so tab task just point to the mapping.

    Hope that helps.

    Thank you

  • Fall in the stored procedure option

    Hi Expert,

    I created the option in one of my stored procedure for testing purposes and now I am trying to drop the option and let the stored procedure, anyone know how I can do? Thank you!

    If what you want is to eliminate the Option that you have created in your Proc, you only need to:

    Expand the sign + to the left of you proc;

    Select the option that you want to remove;

    Press DELETE, or right-click and delete:

    I hope this can help you!

Maybe you are looking for