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

Tags: Database

Similar Questions

  • 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

  • SQL stored procedure input and output parameters

    Hello Gang,

    My dead end trying to call a stored procedure in SQL Server 2008 with the LV database tool.

    for purposes of experimentation, I've created a small procedure with an input parameter that returns an integer as return value.  It works describing a query, but all attempts at LV produce an error-2147217900 when executing query VI.  I did find examples of that.

    Sending a bunch of parameters to a stored procedure and checking the value of return seems to be pretty common stuff.

    I'll appreciate any help.

    Thank you

    Roger

    Hi Roger,

    There are a few prerequisites which I will list below. If you have not checked these things, so don't hesitate, as your hiccups can be there.

    Prerequisites:

    1. Ensure that you can read from a table in the database to verify that you can access the database (user permissions) and ensure that your login details are correct. Among other things, make sure that the. DSN switches to the correct database. (See the simple example below, SQL Select.vi)
    2. Make sure that your user (if you use SQL authentication) has permissions to run the STORED procedure by running the procedure in SQL Server Management Studio (you seem to have already done this)

    Example by calling a procedure without parameters (attached as SPROC_No_Parameters.vi):

    Example by calling a procedure with parameters (attached as SPROC_Parameters.vi):

    An article on the execution of stored procedures is here:

    http://digital.NI.com/public.nsf/allkb/07FD130746083E0686257300006326C4

    Don't forget to download the example VI since it includes the cases where you want an output parameter of the procedure rather than a table.

    I tested these against two very simple SPROCs and it worked fine (on SQL Server 2005, but 2008 should be the same).  Stored procedures have been:

    CREATE PROCEDURE [dbo]. [GetContacts]

    AS
    BEGIN
    -SET NOCOUNT ON added to avoid additional results sets from
    -interfering with SELECT statements.
    SET NOCOUNT ON;

    -Controls insert for procedure here
    SELECT * FROM Contacts
    END

    and

    CREATE PROCEDURE [dbo]. [MultiplyAges]
    @param1 INT = 1
    AS
    BEGIN
    -SET NOCOUNT ON added to avoid additional results sets from
    -interfering with SELECT statements.
    SET NOCOUNT ON;

    -Controls insert for procedure here
    SELECT (age * @param1) OF Contacts
    END

    I would like to know if these examples work for you or if you have any other questions.  Don't forget to go through this KB article and articles related to it, they should cover other situations.

    Matt

  • 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.

  • Logic of tip insert - using a stored procedure?

    Here's my use case:

    • I have a table called TAGS that has two columns: id (number key, primary) and text (string)
    • the table has a constraint of database set that each text must be unique
    • the table also has a fixed sequence back next id available
    • I created an entity of the DB object and its default View object
    • I also created a page where I display a table read-only based on the View object
    • Finally, I added a text field and a button to the page
    • What I want to achieve is to insert all tags entered in the entry in the table fields, when the button is clicked. Note, however, that the entry field is a comma-separated list of tags, moreover, I have to insert only those tags that are new (to respect the constraint of database), and finally, I would like to use the sequence in insert or orders. Once completed, the page should also be updated.

    My first question is whether a stored procedure is the right way to perform such a step insert logical. If not, what other means must be used in the ADF.

    My second question is to know how to call the stored procedure and pass it the value of the input as a parameter field. I found this article http://andrejusb.blogspot.cz/2011/04/invoking-stored-procedures-and.html, but miss me a few transition points:

    1. How the callGreetingsFunction method call (I just get it that it's a method of the EO generated Java class?) after that the button is clicked?
    2. How to pass the value of the input field in this method as a parameter?

    Thanks in advance for your help.

    Now, what happens if I run it like this:

    A. the procedure is executed after a click on the button

    (B) the page is not updated (I had to do the research to get the new lines are visible in the table)

    C. the constraint is ignored (after discounting there were several lines with unique identification number, but pr is - empty)

    D. nothing has been committed to the database - if I closed the application window and it start again, the lines have disappeared from the table, but addition of new lines used number of increased seq

    E. Similarly, if I did directly inserts into the database, these lines did not appear until I transferred the application

    B. told it page to refresh. And that's usually enough to refresh your ViewObject with: viewObject.executeQuery)

    C. Si the constraint is not enforced for null values. And this has nothing to do with the adf, this is related to oracle db.

    D. you're calling commit.

    E. you must re-run your view object (viewObject.executeQuery ())

    Nevertheless, here is my rookie questions:

    There there a simple way to refresh the page (or just the table containing the data)?

    -How to validate changes (immediately after execution of the procedure)?

    -How is the constraint has been ignored? I am sure it would fail on validation, but I thought that it will be considered even for adding data to the table.

    -Are there a way to update the original Version of the database every time that the page is opened or refreshed?

    -Drag and drop operation Execute like button on your page (or call vo.executeQuery () by program)

    -Drag and drop the operation of posting as a button on your page (or invoke it by programming on the DBTransaction object)

    -ignored for what values? for null values? It is expected, because each null is "unique."

    -Yes, but you probably shouldn't do that for performance reasons, see this: Andrejus Baranovskis Blog: Cache results for ADF iterator property

    Read also this: Andrejus Baranovskis Blog: job ADF and PL/SQL Invocation changes side effect

    Dario

  • ODP 12 c version 3 with EF 6.1.1 I can't add Stored Procedure of a package to my model

    I use the ODP 12 c Release 3 (12.1.0.2.1), with Entity Framework 6.1.1 with the first database in MS Visual Studio 2013 update 4

    I have a MVC 5 (.Net Framework 4.5.2) project that connects to Oracle 11 G R2 Database server, an existing database (Tables, views and a pack of Stored procedures)

    I can add tables and use them successfully in my model
    I can add a simple stored procedure

    Here's the problem:
    I have my .edmx file right click and click on "update model from database...". «, on the 'Add' tab, I chose «Stored procedures and functions»
    I can see the list of procedures stored in the package (format packageName.usp) and check the box for the stored procedure of my package, then click 'Finish' to start the update process.

    No stored procedures have been added to my Model.Store


    The only possible exit I get the 'entity data model' is:
    Generated template file: Model1.edmx.
    Loading metadata from the database took 00:00:00.5803351.
    The model generation took 00:00:00.3761861.

    How to add a stored procedure from a package with the Entity Framework 6.1.1?

    I found the answer.

    When in the edmx model and you right click "Update Model database.

    Uncheck "Import selected stored procedures and functions in the entity model", select the package and update procedures. (It works)

    Then in "Model Explorer" under "Model. Store\ stored procedures/functions" you will see your procedures in the package (finally). Then their card in "Function Imports".

    I don't understand why unchecking import stored procedures works, but it does.

    I also found easier to simply call the procedure directly and not using Entity Framework, as all my procedures are: insertion, update and deletions and not all parameters mapped on the model for the view.

  • Test the stored procedure

    Hello

    I wrote a stored procedure and want to test it now. My procedure is here:

    create or replace PROCEDURE PRC_NEW_FAC_RECORD)

    p_F_ID in NUMBERS

    p_F_LAST IN VARCHAR2,

    p_F_FIRST IN VARCHAR2,

    p_F_MI in TANK,

    p_LOC_ID in NUMBERS

    p_F_PHONE IN VARCHAR2,

    p_F_RANK IN VARCHAR2,

    p_F_SALARY in NUMBERS

    p_F_SUPER in NUMBERS

    p_F_PIN in NUMBERS

    p_F_IMAGE IN BLOB)

    AS

    NUMBER OF F_SALARY;

    BEGIN

    SELECT AVG (P_F_SALARY) * 0.75 IN F_SALARY FROM DUAL;

    INSERT INTO VALUES FACULTY (p_F_ID, p_F_LAST, p_F_FIRST, p_F_MI, p_LOC_ID, p_F_PHONE, p_F_RANK, F_SALARY, p_F_SUPER, p_F_PIN, p_F_IMAGE);

    DBMS_OUTPUT. Put_line ("member of faculty added '");

    END;

    /

    I created a table with the following values:

    Faculty of CREATE TABLE

    (f_id NUMBER (6))

    f_last VARCHAR2 (15).

    f_first VARCHAR2 (15).

    f_mi char (1),

    loc_id NUMBER (5) not null,

    f_phone VARCHAR2 (10),

    f_rank VARCHAR2 (9).

    f_salary number (9,2),.

    f_super NUMBER (6).

    f_pin number 4,

    f_image BLOB,

    Faculty_f_id_pk KEY (f_id) PRIMARY, the CONSTRAINT

    Faculty_loc_id_fk of the CONSTRAINT FOREIGN KEY (loc_id) REFERENCES rental (loc_id));

    How would test my procedure on this table, especially if it is a foreign key?

    This is the insert, I tried to run:

    insert into faculty values ('6', 'John', 'Bonny', have ', '13', '4079347153', 'Full', '80000', ' 2', 6034', Null ");

    But I get an error message.

    Thank you very much for your help

    insert into faculty values ('6', 'John', 'Bonny', have ', '13', '4079347153', 'Full', '80000', ' 2', 6034', Null ");

    It is not necessary to join several columns in single quotes.

    How would test my procedure on this table, especially if it is a foreign key?

    First of all create a record in the location table, note the value of the loc_id column. Then newrecord Insert in the table of the Faculty and either enter NULL or use the loc_id you have noted before for loc_id column in the insert statement.

    If you want to insert data with the procedure, and then run the following statement:

    exec PRC_NEW_FAC_RECORD (6, 'John', ' Bonny ', am', NULL... and so forth);

  • [BC] Call a stored procedure taking parameters of table

    Hello!

    I currently have a request of the OIC that makes thousands of calls per second stored procedure. The stored procedure runs a business logic that I want my client application to stay informed.  I want to reduce the cat of the database and instead to call the stored procedure from thousands of times per second, call the procedure (for example) once per second, but with values of one mile.

    I used OCIBindArrayOfStruct successfully to perform inserts bulk, where my OCI application executes a () INSERT INTO using the function "iters" and it might be possible to do something similar with the stored procedure, but I want to do something slightly different, because the procedure stored something like this:

    * If a specific condition is set, call a secondary stored procedure

    * If another special condition is set, insert a row into a table of some

    I so wanted to do was to pass a table (or a series of tables) in the stored procedure, then the stored procedure to use optimal methods that are available, such as FORALL, to perform each of the tasks, the more effectively.

    So I thought to create a type, such as a TABLE OF VARCHAR2, or a VARRAY and possessing of the parameters for the stored procedure based on this type, something like:

    create or replace TYPE 'NTT_VARCHAR2' AS TABLE OF VARCHAR2 (32700);

    create or replace FUNCTION bulk_process_values)

    p_error_message OUT NOCOPY VARCHAR2,

    p_module_context_name OUT NOCOPY VARCHAR2,

    p_sql_error OUT NOCOPY VARCHAR2,

    p_count in NUMBERS

    p_non_array_var_1 IN VARCHAR2,

    p_non_array_var_2 IN VARCHAR2,

    p_array_var_1 IN NTT_VARCHAR2,

    p_array_var_2 IN NTT_VARCHAR2,

    p_array_var_3 IN NTT_VARCHAR2

    < etc. for all the variables in table >)

    RETURN NUMBER

    .. .but I am struggling to find an example of how call the procedure "bulk_process_values" stored, and even if I use a TABLE OF VARCHAR2 or a VARRAY as a parameter type.

    I searched the Internet and found this: OIC - how to bind an array to a stored procedure? - and binding table of the structs (OCIBindArrayOfStruct) sample code

    - but they take different approaches and a bit confused (the second example spoke of OTT).

    I think that the first approach is more likely to be the solution I need - but I can't help thinking - it is a bunch of stuff to move if it does not end up significantly improve performance!

    My questions are:

    * Moves to a call-SP-thousands-of-times-per-second to call-SP-fewer-times-but-with-array-parameters sensitive?

    * Should the table or VARRAY, TABLE OF VARCHAR2 parameters or something else?

    * Should I use for my case OTT?

    Samples I found are both very old - and the second example indicators that the optimal approach evolves with the OCI versions - I'm on 11.2, what is the optimal approach these days?

    * < added later > why is there no official useful example?

    Thank you very much

    Much appreciated. https://community.oracle.com/message/4528528#4528528 has actually worked, with VARRAY, with a proof of concept. Now I just need to shake a little and then get my PL/SQL for optimal PC experts. I think I was really discouraged by the lack of official documents, with the Community (Paradise) is the only way to get real results.

    Thank you JJ.

    I intend me to use the binding enforcement of the table and the table and avoid N back and forth, but I do not then get the opportunity to do something clever in the PL/SQL.

    In the PL/SQL, there is no logic occurring - I don't call the same SP tons of times, but then I want to be able to use PL/SQL optimizations such as FORALL, BULK COLLECT, reduce the number of validations and others.  There is a commit after each SP run, because otherwise the nature of demand means that the application hangs occur; However, there is a way (I think) be smart on the part that is likely to deadlock (making a shape on the Bay First, then applying the updates in the order sorted and then failed to get a blocking theoretically), and then FORALL insert for the second part of the stored procedure.

    I guess I may apply the single return, passing a table (to a commit in the SP)-which will reduce back and forth, so gain in performance, but it will not reduce the number of validations that I do - and Oracle said that commits too frequent is not good for performance. I already have code in my framework that does - by making a simple INSERT INTO.

    Good to hear that OTT is not explicitly required - and VARRAY resembles the approach to try first.

  • Stored - procedures to obtain column information

    Hello

    Recently, I changed to unmanaged code ODP ODP managed (I use Entity Framework).

    Unmanaged pilots worked very well after adding the necessary information in the section of web.config. I could add stored procedures and generate complex types using Import - to obtain column information.

    After the switch, the configuration section has been updated and everything seemed to work. By the way changes in the format of the configuration section is little documented - to say the least.

    However when I try to generate complex types again, I just get a "System.notSupportedException' (Message: the specified type is not supported by this selector).

    This feature was not worn supported by drivers? Is there something that can be done to enable this feature?

    The Ref Cursor implicit config file format differs between managed and managed ODP.NET ODP.NET.

    To save you from pulling your hair, do the following.

    (1) install ODT 12.1 if you have not already

    (2) find the procedure stored in the Server Explorer, right click and run and enter the input parameters.

    (3) for the output ref cursor that represents the return value for the function of your entity, choose 'Add to the Config' check box.

    (4) and select either "Show Config" (and then cut and paste) or "add to configuration".

    Here is a screenshot of what I'm talking about:

    http://i.imgur.com/t1BfmUP.gif

  • relative to the parameter in a stored procedure returns

    I'm doing a sp sp / sql with select and update, the idea is to return the value assigned in the select, but when I test the procedure about adding the parameter to the method PPerformance does not, in fact I am new to oracle, I searched some tutorials but I have not managed to solve the problem


    my source its:
    create or replace
    PROCEDURE PA_CONSECUTIVO (TipoConsecutivo in  VARCHAR2, AUXI OUT int )
    
    AS
    aux2 int;
    BEGIN
    
     SELECT consecutivo + 1 into aux2 FROM  tbl_consecutivo
        WHERE UPPER(ltrim(rtrim(Tipo_Consecutivo))) = UPPER(ltrim(rtrim(TipoConsecutivo)));
        
        UPDATE tbl_Consecutivo SET consecutivo = aux2 
    WHERE upper(ltrim(rtrim(Tipo_Consecutivo))) = upper(ltrim(rtrim(TipoConsecutivo))) ;
    
     AUXI:=aux2;
        
    
    
    END PA_CONSECUTIVO;
    the table og the request her:
    TIPO_CONSECUTIVO     VARCHAR2(20 BYTE)
    CONSECUTIVO     NUMBER(38,0)
    FECHAULTIMO     DATE
    I appreciate the help.

    Published by: 1008490 on 29-may-2013 07:49

    Your stored procedure has 2 settings while you provide 1. Use something like:

    SET SERVEROUTPUT ON
    DECLARE
        V_AUXI NUMBER;
    BEGIN
        PA_CONSECUTIVO('ENTRADA',V_AUXI);
        DBMS_OUTPUT.PUT_LINE('AUXI = ' || V_AUXI);
    END;
    /
    

    SY.

  • Trapping errors in stored procedures

    I run queries on a Government computer. There are errors in some of the stored procedures that will NEVER disappear. Reality of life and I have to live with it (I'm just a data analyst - not the developer of procedures)
    If I do this, hoping to catch the error
    BEGIN
         run_stored_proc (my_cursor, my_id, param3);
    EXCEPTION
         WHEN OTHERS THEN DBMS_OUTPUT.PUT_LINE ('ERROR IN ID (' || my_id || '). The error was ' || SQLCODE || ' -ERROR- ' ||SQLERRM);
    END;
    Well, he can still plant.
    SQL> @c:\mysql\run_test
    ERROR IN ID (2692). The error was -20100 -ERROR- ORA-20100: Exception occurred in some_other_stored_procedure
    ORA-01422: exact fetch returns more than requested number of rows
    So, it seems that run_stored_proc calls some_other_stored_procedure, which has problems. I was hoping to trying to capture the error in the procedure at a higher level, it would also seize the error at a lower level 'Sub procedure. It is how works a TRY-CATCH in java. If an error occurs anywhere along the path inside the TRY-CATCH, she is caught. Of course, java ins't of PL/SQL, but is it possible for me to catch a lower level error and do not have this code crash?

    Fortunately for me, it actually does not crash as often. But I have to put this code in a loop, then run it to many different my_id. And when he plant, it is not important from a data analysis perspective. I can't do without a small percentage of the data. But I'd love to be able to just run my script and do not have to look for unexpected accidents.

    This isn't a question about how to solve the error too many lines in the procedure. I don't have access to the procedure, and it's not going to be fixed. I just need to know how to deal with the capture of the error, if it is at all possible.

    I'm not sure I Armi what you're asking here. Your script is not 'crash', it is just to report the error through the dbms_output.put_line statement you added. When you say "I have to put this code in a loop, then run it to many different my_id", do you mean you want to call run_stored_proc multiple times with different values of my_id?

    If so, then it should look like:

    begin
       for rec in (select my_id from wherever) loop
          BEGIN
               run_stored_proc (my_cursor, my_id, param3);
          EXCEPTION
               WHEN OTHERS THEN
                DBMS_OUTPUT.PUT_LINE ('ERROR IN ID (' || my_id || '). The error was ' || SQLCODE || ' -ERROR- ' ||SQLERRM);
          END;
       end loop;
    end;
    

    The other Manager to swallow the error and control will return at the top of the loop statement and execute the procedure with the next value of my_id.

    John

  • Examples of good Contructed stored procedures

    Hi all

    I want to be a programmer "Stored Procedures."

    I want to learn the stored procedure by studying existing that are created for good. Learning the technique on the way in which it is created.

    Can you give me the link of the examples/samples of a lot of stored procedures? I can learn quickly if I read samples/examples.

    I tried Googling but I cannot find a full right. I mean sites with many buildings of example stored procedures and style.


    Thank you very much
    Kinz

    Try:
    -first of all to the SQL in a PL/SQL variable
    d ' print this variable using DBMS_OUTPUT before executing the statement built this PL/SQL variable
    -Use EXECUTE IMMEDIATE
    - and don't forget to activate DBMS_OUTPUT with SQL * more statement: SET SERVEROUTPUT ON.

    Example:

    SQL> set serveroutput on
    SQL> --
    SQL> create or replace procedure drop_dblinks
      2  is
      3    cursor dblink_cur is select db_link from user_db_links;
      4    stmt varchar2(100);
      5  begin
      6  for dblink_rec in dblink_cur
      7  loop
      8  stmt := 'drop database link ' || dblink_rec.db_link;
      9  dbms_output.put_line('Running:' || stmt || ' ...');
     10  execute immediate stmt;
     11  dbms_output.put_line('OK');
     12  end loop;
     13  end;
     14  /
    
    Procedure created.
    
    SQL> exec drop_dblinks;
    Running:drop database link TEST ...
    OK
    
    PL/SQL procedure successfully completed.
    
    SQL>
    

    In your case, you cannot mix single quotes and double quotes: the use of apostrophes first disables any substitution in the character string.

    Edited by: P. Forstmann Nov. 27. 2012 13:21

  • Problem with the stored procedure

    Hello everyone,
    I am French and I am trying to create a stored procedure in my oracle database 10 g R2.

    Here's the code I developed:

    create or replace procedure recgenerator (max_row in number, min_row number) is
    Start
    cursor c_nume_clie is
    Select nume_clie
    from (select rownum rn, nume_clie of the customer)
    where < = max_row and rn > rn = min_row;
    r_nume_clie c_nume_clie % ROWTYPE;
    Start
    Open c_nume_clie;
    loop
    extract the c_nume_clie in r_nume_clie;
    When the output c_nume_clie % NOTFOUND;
    dbms_output.put_line (r_nume_clie.numero);
    end loop;
    close c_nume_clie;
    end;
    end;
    /

    As you can see, the point is to allow a user to select the folder he wants only. I did a slider to get this, but oracle returns me an error and I can't find the source.

    Here is the oracle error:
    SQL > show errors
    Mistakes pour the RECGENERATOR PROCEDURE:

    LINE/COL ERROR
    -------- -----------------------------------------------------------------
    3/11 PLS-00103: symbol 'C_NUME_CLIE' met instead of one of
    following symbols:
    := . ( @ % ;

    could you clarify me please?

    Thank you

    PaulNero

    When you want to print something on the screen you should be sure that you have added your connection to DBMS output.

    Go to the menu 'View'--> 'DBMS output. You can see that there is a new Dbms output window, where you can click the green sign to add your connection. Execute the statement again and you will see that the statement was printed.

  • Problem with the Entity Framework by using stored procedures

    I am developing a project with Oracle DB and Entity Framework.
    Due to performance issues, for some querys I uses procedures stored instead of LINQ queryies,
    When I try to add my model EF procedure, the procedure is added but the Model Designer
    It does not acknowledge the columns returned by the procedure.
    so I can't create something complex to the user the results of the procedure
    in a domain service

    Here's the relevant readme which has some tips: http://www.oracle.com/technetwork/topics/dotnet/tech-info/default-338300.html#mozTocId610465

    If you do a forum search there is further discussion of the issues, and the readme file provided with version beta has also some information.

    But I agree with the general theme: using stored procedures in the EF is a PITA. :( I really hope they do something to make it easier in the future because this is probably the single most important weakness in the implementation of Oracle EF and establishment of a complex type is your time and picky it's ridiculous. (I found it less problematic if your procedure returns a complete picture that your model has already an entity for, because you can get away with only add the entry to one of the configurations for the cursor rather than one for each column.)

    Even an external tool where direct you to the procedure and it creates the configuration entries to be able to copy and paste would be a huge improvement.

  • Call a PL/SQL stored procedure - data type mismatch

    I call a PL/SQL stored procedure from within a procedure of ODI using the specified technique page Cezar and Julien (http://odiexperts.com/how-to-use-plsql-procedures-and-functions-in-odi) and I get the error "Wrong number or argument types»

    I tested each of the types of parameters, in that I'm passing and it is the text that is causing the problem. I tried to use 'Text' and 'Alphanumeric' for the data type of the variable of the ODI and so many VARCHAR2 and VARCHAR for the PL/SQL parameter type and I can't make it work.

    Is there a trick for passing a string in the ODI PL/SQl?

    Hello

    Ensure

    1. to declare/refresh of the variable before call to PL/SQL.

    2. If the variable is of "alphanumeric" ODI calling must be attached to apostrophes and prefix with the code project as ' #MYPROJECT. ODI_Var'

    3. as parameters you have u who must pass both during the call (IN, OUT, etc.).

    Thank you
    Guru

Maybe you are looking for

  • error code. hd521-2w

    Hard drive - Samsung sp2504c windows xp error code hd521-2w

  • My windows program suddenly stopped recognizing my PID.

    Extremely frustrated My windows program suddenly stopped recognizing my PID. How to get help? I can't find a phone number or email address to talk to humans. Why there is no support for the customer?

  • Ethernet card disappear once the cable is not connected

    Hello I bought a HP Pavilion dm4-1164us laptop computer about a month ago. I installed the working node Lock software for my MAC ID of the ethernet card in this laptop. When it's hanging of Ethernet cables, the software works very well. Every time wh

  • two questions about apps headless

    Hi gang,. I have received the approval of _sys_headless_nostop (yay!) and started to refactor my app to be headless. I'm having a little difficulty and could use a couple pointers.  Two questions to begin: 1.) once I receive permission, I have to do

  • Linksys E1000 - OK for Netflix?

    Hello world. My apologies if I posted in the wrong forum.  I've been streaming Netflix through my Wii (wireless).  Yesterday, my router is dead.  I picked up the Linksys E1000.  However, I am not able to stream Netflix more.  All the other functions