Stored procedure to add a record do not add record

I have never successfully added a record via a stored procedure, but I managed with adding records through behaviors using recordsets with stored procedures and server, so I know that connections work. I have the data to MS SQL Server and ColdFusion web page. When I enter data and click 'Submit', it does absolutely nothing. When I check the SQL table, no record has been added. Any help would be greatly appreciated. Here are my stored procedure:


Replace:



Null value

With:

I provide each form with a value variable by default so that a value will always exist for each variable.

Use the null attribute, if the value is 'yes', WHAT NULL value will be passed to the parameter of the stored procedure, if the content of the attribute value will be used

http://livedocs.Adobe.com/ColdFusion/8/htmldocs/help.HTML?content=Tags_p-q_14.html#1102102

Tags: ColdFusion

Similar Questions

  • 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

  • stored procedure question

    Hello guys,.

    could someone help me in this matter?

    Write a PL/SQL stored procedure that adds a dvd title at the end of the list of movies to a customer. This procedure should take as parameters in entry the customer_ID and film title_ID as your schema defines.

    I wrote the below procedure. I am a very beginner, I appreciate your help.

    create or replace
    PROCEDURE PROC_MOVIE_TITLE
    (CUST_ID IN VARCHAR2, DVD_ID IN VARCHAR2)
    AS

    BEGIN
    SELECT r.memberid, d.dvdid in CUST_ID, DVD_ID
    R, d dvd RENTAL
    where are.dvdid = d.dvdid;



    END PROC_MOVIE_TITLE;

    Add new column as "dvdtitle" in the table of the rental.
    And follow these steps

    create or replace procedure upd_dvdtitle (p_dvdid number)
    is
    Start
    Update rental r set dvdtitle = (select dvdtitle from dvd d where d.dvdid = p_dvdid)
    where are.dvdid = p_dvdid;
    end;

  • Insert a record, call a stored procedure and execute a shell script

    Hello

    I am trying to build a page APEX do these three things in order.

    #1. Insert a new record in a database table (pk, donnees_xml, attr1 and attr2, etc.) and download the XML file to the donnees_xml column

    #2. Save this XML file on a file system

    #3. Parse the XML file on a file system and update the database with the parsed data table

    I can do #1 with a regular shape based on the database table. I can do #2 with a stored procedure.

    I can do #3 with a shell script.

    I wonder how these tasks can be combined into a single action in APEX.

    do #1;

    If successful, do #2;

    If successful, do #3;

    I'd appreciate comments on this.

    Thank you

    Define a process of PL/SQL page submit that runs after the record is inserted, if P1_FILE is not null.

  • Transaction in stored procedure not treated as Atomic?

    Hello

    I have a stored procedure that inserts a line in a table called reservations and also decrement the places available for an event.

    For example: at an event, there are 100 places available. After you add a reservation, it will be left only 99 seats.

    I also have a Java program that sends 100 concurrent transactions to the database.

    After 100 transactions, there are 100 reservations, but there are still about 60 free places.

    So, I guess that the transaction he has not treated as atomic. I don't know why some transactions fail?

    The code of the stored procedure:

    create or replace PROCEDURE procedureOne (s_price, NUMBER, NUMBER, of s_customer)

    s_event NUMBER, DATE, s_movie NUMBER of s_dat)

    IS

    s_ev NUMBER;

    s_free NUMBER: = 0;

    BEGIN

    commit;

    Set transaction read write;

    Start

    SET TRANSACTION ISOLATION LEVEL READ COMMITTED;

    Select Event_ID, Free_seats EN s_ev, s_free

    events

    where ID_Movie = s_movie;

    If s_free > 0 then

    Start

    update events set Free_seats = s_free-1;

    insert into values of reservations (seqa_seq. NEXTVAL, s_dat, s_customer, s_event, s_price);

    commit;

    end;

    on the other

    Start

    Rollback;

    end;

    end if;

    end;

    commit;

    end procedureOne;

    invatacelul wrote:

    So, I guess that the transaction he has not treated as atomic. I don't know why some transactions fail?

    You said: "I also have a Java program that sends 100 concurrent transactions to the database. Atomicity applies to a single transaction - it says transaction executes all or nothing. Is what you run in isolation. If you want isolation unless you serialize, transaction 2 sees no uncommitted transaction 1 results because the READ COMMITTED isolation level indicates that a transaction can read only the data that has been committed to the database. And since you wrote your code as SELECT + UPDATE you get results you never expected. Use:

    UPDATE OF EVENTS

    SET FREE_SEATS = FREE_SEATS - 1

    WHERE ID_Movie = s_movie

    AND FREE_SEATS > 0;

    SY.

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

  • Could not import the Pentecost Entity Framework stored procedures

    Hi, I have a problem with Entity Framework 5 and stored procedures. I can add stored procedures to mi with "Update Wizard" solution, but them does not show in the Model Explorer and I can't use my code. I have ODAC 12 c Release 2 installed in my pc.

    There is a bug in the database Oracle 12 c that occurs only with a snap-in database. It is fixed in the next group of patches from database. (bug #17448545)

    There are three workarounds in the meantime:

    (1) to re-create the database without the shared option (no plug-in database)

    (2) install your schema in the database of the container instead of a snap-in database. You will need a user name as C ##HR to do. It is not advisable on a production database.

    Add 3) the section of manually in in the edmx file. Note that this is deleted when you "Generate database from model" or "Update model from database".

    for example:

    ...

    ParameterTypeSemantics = "AllowImplicitConversion" scheme = "SCOTT" >

  • Delete records from sys.aud$ stored procedure

    We have a stored procedure that attempts to move the records from the table of sys.aud$ to a history table (in order to keep sys.aud$ to a more reasonable size, I guess - full disclosure, I have not written this proc). Base flow is:
    Select count (*) in the number of lines of sys.aud$
    If {(rowcount > 1000)
    copy all rows in sys.aud$ in the history table
    remove from sys.aud$
    }

    I says this proc used to work perfectly in a troubled past (I'm new on the client) but now has not worked for a while. When we try to compile the proc, we get the error
    "table or view does not exist", and the line is the "deletion of sys.aud$. The line "select count (*) from sys.aud$ ' seems to cause no problems, but the proc does not compile as is. If I comment out the line "remove from sys.aud$", however, the proc compiles very well.

    Confusingly, if I log in as the same account that owns this proc, I can run both the count (*) select from sys.aud$ AND remove clauses sys.aud$ with no complaint at all (by modifying slightly to work with 1 single record at a time, of course), but I can't seem the same to compile in a stored proc.

    I guess that it is related permissions? Can someone point me to the permissions of the owner needs to be able to remove from sys.aud$ in a stored procedure? Or is there something else that needs to be done here? Pointers much appreciated.

    Thank you.

    956928 wrote:
    We have a stored procedure that attempts to move the records from the table of sys.aud$ to a history table (in order to keep sys.aud$ to a more reasonable size, I guess - full disclosure, I have not written this proc). Base flow is:
    Select count (*) in the number of lines of sys.aud$
    If (rowcount 1000 >) {}
    copy all rows in sys.aud$ in the history table
    remove from sys.aud$
    }

    I says this proc used to work perfectly in a troubled past (I'm new on the client) but now has not worked for a while. When we try to compile the proc, we get the error
    "table or view does not exist", and the line is the "deletion of sys.aud$. The line "select count (*) from sys.aud$ ' seems to cause no problems, but the proc does not compile as is. If I comment out the line "remove from sys.aud$", however, the proc compiles very well.

    Confusingly, if I log in as the same account that owns this proc, I can run both the count (*) select from sys.aud$ AND remove clauses sys.aud$ with no complaint at all (by modifying slightly to work with 1 single record at a time, of course), but I can't seem the same to compile in a stored proc.

    I guess that it is related permissions? Can someone point me to the permissions of the owner needs to be able to remove from sys.aud$ in a stored procedure? Or is there something else that needs to be done here? Pointers much appreciated.

    Thank you.

    acquired through ROLE privileges are NOT applicable within the named PL/SQL procedures.

    GRANT DELETE ON SYS. AUD$ ;

  • Insert multiple records in a database using the DB adapter and stored procedure

    Hi all

    I want to insert multiple records in a database using a stored procedure. I wanted to insert these records using a data adapter and data adapter must be called by a mediator.

    Can anyone suggest me some ideas if it's possible with capabtilities OOB in SOA suite or not?

    Thank you for your help in advance.

    Thank you
    Shiv

    The trick is in the stored procedure. You must use a data type that will handle multiple records I use varray. An example can be found in this post.

    Re: Mutiple calls to AppsAdapter (pl/sql) when the payload has multiple records

    When you read the procedure stored in the db adapter wizard looks and xsd / xml if you have maps accordingly.

    see you soon
    James

  • Using the stored procedure: Source does not have a target executable

    I'm a guy from MS - SQL, so I'm fairly familiar with T - SQL syntax, but feels a heck of a time trying to take the code I wrote for SQL and turn this works with Oracle.

    in any case, I'm using Oracle SQL Developer, and I have a stored procedure that calls the Alter Table statement and adds a column. Just trying to get this one to work before moving on to the other that I have. I get the message that source does not have a target executable when I try to run this command.

    create or replace PROCEDURE rta_conv_addcolumn (rtatablename1 in varchar (20),)
    rtatablename2 in varchar (20),
    rtacolumnname in varchar (256),
    rtacolumninfo in varchar (256))
    AS
    DECLARE rtasql VARCHAR (4000);
    BEGIN
    IF EXISTS (SELECT * from user_tables WHERE table_name = rtatablename1)
    AND NOT EXISTS (SELECT * from user_tab_columns WHERE column_name = rtacolumnname)
    AND table_name = rtatablename1)
    AND NOT EXISTS (SELECT * from user_tab_columns WHERE column_name = rtacolumnname)
    AND table_name = rtatablename2)
    Then rtasql: = ' ALTER TABLE ["+ rtatablename2 +"] ADD "+ rtacolumnname +" "+ rtacolumninfo;
    Run (rtasql);
    END rta_conv_addcolumn;

    If I try to compile I get the following messages, which make no sense, since the syntax I use to declare the input variables seems to be good.

    Error (1.54): PLS-00103: encountered the symbol "(" quand attend une deles de valeurs suivantes:: =.), @ default % of the characters of the symbol ': = ' has been replaced by "(" pour continuer.)
    Error (2.29): PLS-00103: encountered the symbol "(" quand attend une deles de valeurs suivantes:: =.), @ default % of the characters of the symbol ': = ' has been replaced by "(" pour continuer.)
    Error (3.29): PLS-00103: encountered the symbol "(" quand attend une deles de valeurs suivantes:: =.), @ default % of the characters of the symbol ': = ' has been replaced by "(" pour continuer.)
    Error (4.29): PLS-00103: encountered the symbol "(" quand attend une deles de valeurs suivantes:: =.), @ default % of the characters of the symbol ': = ' has been replaced by "(" pour continuer.)
    Error (6.1): PLS-00103: encountered the symbol "DECLARE" when expecting one of the following: begin function package pragma procedure < an ID > subtype type use < a between double quote delimited identifiers of > form current cursor external language the symbol 'start' is substituted for 'SAID' continue.
    Error (15.5): PLS-00103: encountered the symbol "RTA_CONV_ADDCOLUMN" when expects it one of the following values: If

    Adds the column to the table specified in rtatablename1, if there is neither rtatablename1 nor rtatablename2.

    NOT TESTED

    create or replace PROCEDURE rta_conv_addcolumn(rtatablename1 in varchar,
    rtatablename2 in varchar,
    rtacolumnname in varchar,
    rtacolumninfo in varchar)
    AS
    rtasql VARCHAR(4000);
    count1 number;
    count2 number;
    count3 number;
    BEGIN
      SELECT count(*) into count1 FROM user_tables WHERE table_name = rtatablename1;
      SELECT count(*) into count2 FROM user_tab_columns WHERE column_name = rtacolumnname AND table_name = rtatablename1;
      SELECT count(*) into count3 FROM user_tab_columns WHERE column_name = rtacolumnname AND table_name = rtatablename2;
      IF count1>0 AND count2 = 0 AND count3=0 Then
        rtasql:= 'ALTER TABLE '|| rtatablename1 ||'ADD ' || rtacolumnname || ' ' || rtacolumninfo;
        Execute immediate rtasql;
      END IF;
    END rta_conv_addcolumn;
    /
    

    Max

    Published by: Massimo Ruocchio, December 12, 2009 02:15
    Missing AND

  • BPEL does not receive "return value" of MS SQL, stored procedure

    Hello

    We are facing this problem citing a MS SQL stored procedure the BPEL (jdbc 1.2 driver). We have created the wsdl for the stored procedure correctly using a command line utility tool provided with Oracle SOA Suite.
    But the question is THAT BPEL is not able to get the data present in the statement of "return" of the procedure. We receive null output. But it is able to extract the data from the output variable, if any. Case 1 below is for the return statement. Case 2 is for the output variable


    Case 1: in the following, the output is returned using the return statement. The BPEL that calls this procedure is to obtain a NULL value as an answer to this.


    ALTER PROCEDURE [dbo]. [AddNumbersRet]
    -Add the parameters for the procedure
    @Number1 int,
    @Number2 int
    AS
    BEGIN
    -SET NOCOUNT ON added to avoid additional results sets from
    -interfering with SELECT statements.
    SET NOCOUNT ON;

    -Controls insert for procedure here
    Return (@Number1 + @Number2);
    END

    Case 2: in the following, the output is returned using the SumOfNums output variable. The BPEL that calls this procedure is to obtain a correct answer.


    ALTER PROCEDURE [dbo]. [AddNumbers]
    @Number1 int,
    @Number2 int,
    @SumOfNums int output
    AS
    BEGIN

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

    Set @SumOfNums = (@Number1 + @Number2);

    END



    Case 1 is a failure and case 2 is successful. We cannot change our procedures similar to case 1 to use variables of output because of dependencies on other applications.

    All the world is facing this problem? This looks like a bug in BPEL. Please, share your experiences.


    Thanks and greetings

    Mohan

    Published by: user10980910 on December 8, 2009 05:16

    There is a gap in the command line utility that was addressed in the adapter configuration (AS11gR1) Wizard. The API is a procedure, not a function, so does not return the query for the parameters that the utility made anything for the RETURN statement.

    The adapter configuration wizard is unable to say if there is a RETURN statement either, but it provides the user with a check box that can be used to indicate the presence of the declaration. In the wizard, if you check the checkbox, a parameter is added to the XSD to the RETURN statement. In essence, the adapter will process the procedure as a function and you will get the value of the PERFORMANCE.

    Usually, I wish to indicate that you certainly should NOT change the generated XSD. But you might be able to do it, by adding the necessary element to the OutputParameters for your RETURN statement. Add the following immediately AFTER the element of 'Lines', which occurs first in the XSD and BEFORE all items for the other none.

    Use a value for the "" that is meaningful to you. The wizard uses the name of the stored procedure with the name of the element. We could call this "RETURN_VALUE" or else if is more to your liking. Add the item after you generate the XSD using the command line utility, and then use the XSD when you model your BPEL processes. The WSDL should already have the content for this element handling.

  • Basic stored procedure helps - not the return data

    Hi all:

    To be fair, I come from a SQL Server environment and have never written anything for PL/SQL / Oracle before, this is my first attempt, so if nothing is better or more effective, please let me know. The immediate problem I'm having is, I have the following stored procedure, and all I want to do is return the data in the table, so that I can fill my DataSet in code. But when I run the code against this stored procedure, it still don't bring back any data (if I just do a standard "SELECT * FROM lkAllocation", I get the results, so I know data are there and the connection is good). If execution of the procedure in my window in Oracle SQL Developer (call PAYSOL.spallocationselectall ();), my results displays no data as well. What is the problem with this stored procedure?


    create or replace
    PROCEDURE spAllocationSelectAll IS
    Whole AllocationID;
    AllocationName Varchar2 (50);

    BEGIN
    AllocationID: = 0;
    AllocationName: = ";

    SELECT
    AllocationID,
    AllocationName
    IN
    AllocationID,
    AllocationName
    Of
    lkAllocation
    ORDER BY
    AllocationName;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    NULL;
    WHILE OTHERS THEN
    -Consider recording the error and then re-raise
    LIFT;
    END spAllocationSelectAll;

    Well, I'm not really in .net (I would participate in another forum so ;)), but this might be useful?

    Value (Oracle.DataAccess.Types)      System.Data.DbType      OracleDbType
    OracleRefCursor      Object      RefCursor
    

    http://download.Oracle.com/docs/CD/B19306_01/win.102/b14307/featOraCommand.htm#g1025379
    http://download.Oracle.com/docs/CD/B19306_01/win.102/b14307/featOraCommand.htm#g1025072

    Perhaps the [forum Windows and .net | http://forums.oracle.com/forums/category.jspa?categoryID=44] is worth a try as well.

  • Stored procedure or Tigger in order to update to 20,000 records every night?

    Hello world

    I have a question about stored procedure or trigger.

    Here's the situation:

    I need to empty 20,000 records in table A in the database of progress to a B in Oracle table, every night. This is done by a planner and it's fine. Now, I need to update the table C for these 20,000 records in table B, either during the discharge of A to B, or after the dump is done.

    Which way you think it's better in terms of performance for 20,000 records to be updated in table C.

    1 - Update table C in the discharge of A to b: specify a trigger for each record added to table B, do the update in table c. (meaning it will unleash 20,000 times)

    2 - Update table C after the dump from A to B is done: specify a stored procedure and call it by a scheduler to do the update to table C (which means that the cursor must navigate 20,000 files and do the update for each of them in table C)


    Any ideas would be greatly appreciated.

    Mona

    I agree that the second option is better, but it took me by surprise:

    user2372480 wrote:
    2 - Update table C after the dump from A to B is done: specify a stored procedure and call it by a scheduler to do the update to table C (* which means that the cursor must navigate 20,000 files and do the update for each of them in table C *)

    I interpreted that as a record by the other treatment as in:

    OPEN CURSOR
    LOOP
    -- update a single record here
    END LOOP
    

    If this is the case, try and combine all the updates in a single SQL statement if you can. If this is not the case, try treatment in bulk.

    HTH!

  • Why these stored procedures his does not work

    Hi I'm new and I need help following SQL works correctly, but when I walked into a stored procedure me displays error

    SELECT Por.PortalID,

    Name,

    Lower (LTrim (RTrim (SEOName))) SEOName,

    IsParent,

    Por.Parentid,

    (Select Seoname

    Portal port

    Where Por.Parentid = Port.Portalid) Parentportalname;

    SettingValue.SettingValue DefaultPage

    Por PORTAL

    JOIN SettingValue

    ON Por.PortalID = SettingValue.settingtypeid

    Where Settingtype = 'SiteAdmin '.

    And Settingkey = 'PortalDefaultPage. '

    his return:

    Portald Name SEONAME ISPARENT ParentId parentportalname DefaultPage
    1by defaultby default10nullHomepage

    It's my stored procedure

    create or replace

    Procedure Sp_Portalgetlist as

    Start

    SELECT Por.PortalID,

    Name,

    Lower (LTrim (RTrim (SEOName))) SEOName,

    IsParent,

    Por.Parentid,

    (Select Seoname

    Portal port

    Where Por.Parentid = Port.Portalid) Parentportalname;

    SettingValue.SettingValue DefaultPage

    Por PORTAL

    JOIN SettingValue

    ON Por.PortalID = SettingValue.settingtypeid

    Where Settingtype = 'SiteAdmin '.

    And Settingkey = 'PortalDefaultPage ';

    END SP_PORTALGETLIST;

    When I compile with oracle sqldeveloper show this error:

    • Error (4.1): PLS-00428: an INTO clause in this SELECT statement

    I appreciate all the help

    What about the compile error in a PL/SQL block a select statement has an additional part:

    Select attr1, attr2...

    in var1, var2,...

    Of...

    but you can also use your selection (without the) in a cursor:

    procedure is...

    cursor my_select is

    Select...;

    my_variable my_cursor % rowtype;

    Start

    Open my_cursor;

    extract my_cursor in my_variable; -fails at the record and then one more found!

    close my_cursor;

    ...

    Good bye

    DPT

  • Link to database not be created using a stored procedure

    Hello

    I am creating a link of database using a stored procedure.

    Here is the code for it

    CREATE OR REPLACE PROCEDURE create_db_link (ca_db_name IN VARCHAR2,

    ca_service_name IN VARCHAR2)

    AUTHID CURRENT_USER IS

    BEGIN

    EXECUTE IMMEDIATE ' create public database link test_db_link connect to ca_db_name identified by ca_db_name using "ca_service_name" ';

    END create_db_link;

    During execution of the code is created the db_link. But, when I ask all_db_links I get the following result.

    OWNER

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

    DB_LINK

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

    USERNAME

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

    HOST

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

    CREATED

    ---------

    PUBLIC

    TEST_DB_LINK. WORLD

    CA_DB_NAME

    ca_service_name

    20 Aug 13

    Could you please help me understand why it shows the parameter names in the name column of the USER and the HOST instead of the name of the database and the name of the service?

    This is to show exactly what you said to do.

    Did you expect that Oracle would read as if by magic through your string you passed to run immediately and magically know to replace all occurrences of the string that correspond to local (or even global) parameter/variable names with the values of these variables?  It does not work like that.  You could concatenate the values into the string.

    for example

    EXECUTE IMMEDIATE ' create public database link test_db_link connect to ' | ca_db_name |' identified by ' | ca_db_name: ' using the "' | ca_service_name | " ' ;

    But why are create you database links running?  Shouldn't this be part of the design of your application and the initial fact before the application runs?

Maybe you are looking for