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

  • Home
  • SEARCH
  • 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 7055103
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:42:28+00:00 2026-05-28T03:42:28+00:00

Iam trying to create a string for using in execute_immediate statement for inserting into

  • 0

Iam trying to create a string for using in execute_immediate statement for inserting into a table. One of the columns used is a BLOB type. Iam using the ‘||’ operator to append columns and build the sql. BLOB type doest seem to work with ‘||’. See sample code (not original) and error

declare
    FIRST_NAME varchar2(10);
    PICTURE blob; -- blob type
    TEMP_STR varchar2(2000);
begin
    FIRST_NAME := 'Arun';
    -- a blob is created
    DBMS_LOB.CREATETEMPORARY(PICTURE, true); 

-- next line works
insert into BLOB_TEST (PERSON_NAME,PHOTO) values (FIRST_NAME,PICTURE);

-- creating the string
TEMP_STR := 'insert into BLOB_TEST values (''' || first_name||''''||','||PICTURE||')';
-- just to view the string
DBMS_OUTPUT.PUT_LINE(TEMP_STR); 

/* code to be done */
-- execute immediate(temp_str); 
end;

ERROR

Error report:
ORA-06550: line 9, column 17:
PLS-00306: wrong number or types of arguments in call to '||'
ORA-06550: line 9, column 5:
PL/SQL: Statement ignored
06550. 00000 - "line %s, column %s:\n%s"
*Cause: Usually a PL/SQL compilation error.
*Action:

My table BLOB_TEST is

create table BLOB_TEST
(
PERSON_NAME varchar2(20),
PHOTO blob
);

Please help. What i want is an option to execute insert statement dynamically to insert BLOB value to a table.

  • 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-28T03:42:29+00:00Added an answer on May 28, 2026 at 3:42 am

    Even with dynamic SQL, you should use bind variables. Problem solved.

    SQL> CREATE TABLE blob_test (PERSON_NAME VARCHAR2(10), PHOTO BLOB);
    
    Table created.
    
    SQL> DECLARE
      2     FIRST_NAME VARCHAR2(10);
      3     PICTURE    BLOB; -- blob type
      4     TEMP_STR   VARCHAR2(2000);
      5  BEGIN
      6     FIRST_NAME := 'Arun';
      7     DBMS_LOB.CREATETEMPORARY(PICTURE, TRUE);
      8     INSERT INTO BLOB_TEST (PERSON_NAME, PHOTO) VALUES (FIRST_NAME, PICTURE);
      9     TEMP_STR := 'insert into BLOB_TEST values (:person,:myblob)';
     10     execute immediate(temp_str) using first_name, picture;
     11  END;
     12  /
    
    PL/SQL procedure successfully completed.
    

    It is exceedingly rare to NOT use bind variables. Using bind variables guarantees that:

    1. The optimizer plan can be reused if the query is executed again with another set of parameters
    2. Your code can’t be affected by SQL injection
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Iam trying to send a string message into a JMS queue created in weblogic
I am trying to create a data table using Jasper reports. I am using
Iam trying to create an iterative server based on datagram sockets (UDP). It calls
Ok so I am trying create a login script, here I am using PHP5
I am trying to create a table with the following: CREATE TABLE GTW_WORKFLOW_MON (
I am trying to create a customized messagebox using javascript but not getting too
I am trying to create a form using the Spring Framework, but according to
I am creating a JSON string using James Newton-King's excellent JSON libary. I create
I'm trying to create a function which references a temporary table in PostgreSQL 8.4.
I need some help I am trying to create a PHP form using sqlite3

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.