Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7658781
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T13:14:46+00:00 2026-05-31T13:14:46+00:00

we have a function if we call it by using SELECT we get the

  • 0

we have a function if we call it by using SELECT we get the error code ORA-14551 “Cannot preform a DML operation inside a query”

select pkg_tools.replace_site(1121,3343) from dual;

how to run this function and get the results

when we run it in SQL developer in this way:

declare
v_return VRACHAR2(200);
begin
v_return := pkg_tools.replace_site(1121,3343);
end;

works with no errors

and we need this function to be called inside PHP

note: I can not paste this function here, because it’s to long, but it does allot of operations including insert and update!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T13:14:47+00:00Added an answer on May 31, 2026 at 1:14 pm

    A function that does DML cannot be called in a SELECT statement regardless of the calling language.

    If you want to do DML and return a value, it would make much more sense to create a stored procedure with an OUT parameter rather than using a function. So it would make much more sense to

    CREATE OR REPLACE PROCEDURE proc_name_return( p_1    IN NUMBER,
                                                  p_2    IN NUMBER,
                                                  p_ret OUT VARCHAR2 )
    AS
    BEGIN
      p_ret := pkg_tools.replace.site( p_1, p_2 );
    END;
    

    and then call that stored procedure from PHP

    $sql = 'BEGIN proc_name_return( :p_1, :p_2, :p_ret ); END;';
    

    If you don’t want to do that, my guess is that you could do something like this as well (adapted from one of the scripts on page 164 of the Underground PHP and Oracle Manual)

    <?php
    $c = oci_connect('hr', 'hrpwd', 'localhost/XE');
    $s = oci_parse($c, "begin :ret :=pkg_tools.replace_site(1121,3343); end;");
    oci_bind_by_name($s, ':ret', $r, 200);
    oci_execute($s);
    echo "Result is: ".$r;
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code in html, I cannot get the Function call back
I have a variable that I'm using to build a JavaScript function call, and
I would like to have a function that can wrap any other function call.
I have function getCartItems in cart.js and I want to call that function in
I have a wrapper around a C++ function call which I call from C#
I have a C program which has a function call that is defined in
I have a function in R that I call multiple times. I want to
I have a function that i need to call on iframe mousemove(). But i
Say I have a function foo that I want to call n times. In
I have an executable that I call using the shell command: Shell (ThisWorkbook.Path &

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.