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 8307417
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T18:31:14+00:00 2026-06-08T18:31:14+00:00

hi i m using this stored procedure DELIMITER $$ DROP PROCEDURE IF EXISTS get_all_user_selected_children_of_preference$$

  • 0

hi i m using this stored procedure

DELIMITER $$
 DROP PROCEDURE IF EXISTS get_all_user_selected_children_of_preference$$

CREATE PROCEDURE get_all_user_selected_children_of_preference(
   IN entity_id INT,
   IN user_type INT,
   IN parent_id INT
)

BEGIN

     DECLARE profilepreferenceid INT;
     DECLARE inpreferenceid INT;
     DECLARE preference_parent_id INT;
     DECLARE prefvalue VARCHAR(50);
     DECLARE no_more_prefrences INT;
     DECLARE element_type INT;
     DECLARE preference_type INT;

     DECLARE cur CURSOR for  select ProfilePreferenceID,PreferenceParentID,PreferenceID,ProfilePreferenceValueAlias,ElementType,PreferenceType from xxxxx  WHERE PreferenceParentID=parent_id AND EntityID=entity_id AND UserType=user_type ;
     DECLARE CONTINUE HANDLER FOR NOT FOUND SET no_more_prefrences=1;

     CREATE TEMPORARY TABLE IF NOT EXISTS temp_user_selected_preference_children(

          ProfilePreferenceID int(11) NOT NULL AUTO_INCREMENT,
          PreferenceIDTmp INT(11),
          PreferenceParentIDTmp INT(11),
          ProfilePreferenceValueTmp varchar(255),
          userProfileIdTmp INT(11),
          elementTypeTmp INT (11),
          PreferenceTypeTmp INT (11),
          PRIMARY KEY (ProfilePreferenceID)     
     );

          SET no_more_prefrences=0;
          OPEN cur;

             dept_loop:WHILE(no_more_prefrences=0) DO

                     FETCH cur INTO profilepreferenceid,preference_parent_id,inpreferenceid,prefvalue,element_type,preference_type;
                     IF no_more_prefrences=1 THEN
                        LEAVE dept_loop;
                     END IF;

                                     INSERT  INTO temp_user_selected_preference_children(ProfilePreferenceID,PreferenceIDTmp,PreferenceParentIDTmp,ProfilePreferenceValueTmp,userProfileIdTmp,elementTypeTmp,PreferenceTypeTmp)
                                        VALUES  (profilepreferenceid,inpreferenceid,preference_parent_id,prefvalue,entity_id,element_type,preference_type);

                                     CALL get_all_user_selected_children_of_preference(entity_id,user_type,inpreferenceid);

             END WHILE dept_loop;

          CLOSE cur;    

END$$
DELIMITER ;

i run it in phpmyamin , it run successfully .

then i am calling it from codeigniter

public function get_user_selected_all_sub_preferencs_of_preference($preference_id,$user_type,$profile_id)
{
    $this->db->query("SET max_sp_recursion_depth=1000");
    $this->db->query("CALL get_all_user_selected_children_of_preference(".$profile_id.",".$user_type.",".$preference_id.")");
    $data= $this->db->query("SELECT * FROM temp_user_selected_preference_children");
    $dara_arr=$data->result_array();

    $this->db->query("DELETE FROM temp_user_selected_preference_children WHERE userProfileIdTmp=".$profile_id."");

    if(is_array($dara_arr)&&count(array_filter($dara_arr))>0){
        return $dara_arr;
    }
    else
    {
        return FALSE;
    }
}   

then it gives the error

A Database Error Occurred
Error Number: 1054

Unknown column 'PreferenceTypeTmp' in 'field list'

CALL get_all_user_selected_children_of_preference(65,2,1)

Filename: C:\xampp\htdocs\elephanti2\system\database\DB_driver.php

Line Number: 330

can not find what is this .

in mysql console , i describe table

enter image description here

please help . thanks in advance

  • 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-06-08T18:31:14+00:00Added an answer on June 8, 2026 at 6:31 pm

    As stated in the manual page on CREATE TABLE Syntax:

    A TEMPORARY table is visible only to the current connection, and is dropped automatically when the connection is closed. This means that two different connections can use the same temporary table name without conflicting with each other or with an existing non-TEMPORARY table of the same name. (The existing table is hidden until the temporary table is dropped.)

    Therefore, the DESCRIBE command that you ran from the MySQL command-line client refers to a different table to that which is in use by CodeIgniter.

    Since the stored procedure uses CREATE TEMPORARY TABLE IF NOT EXISTS, it only creates a new table if one of the same name does not already exist on that connection: perhaps CodeIgniter previously created a table of the same name but with different columns?

    You might have meant to first drop any existing table and then perform a simple create:

    DROP TEMPORARY TABLE IF EXISTS temp_user_selected_preference_children;
    CREATE TEMPORARY TABLE temp_user_selected_preference_children (
    -- etc.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using the following sql: DELIMITER $$ DROP PROCEDURE IF EXISTS `get_auto_increment_settings`$$ CREATE
I've got a mySql stored procedure that looks like this-- delimiter | create procedure
I have this stored procedure CREATE PROCEDURE [dbo].[TestProcedure] @param1 int = 0 ,@param2 int
This is the the sample stored procedure that I am using CREATE PROCEDURE [dbo].[CreateCustomer]
I have a stored procedure that updates a table using linq, eg: (this is
I am right now using this extended stored procedure in one of the test
I'm using this guide to call stored procedure in my projet which using EF4
Below is a simplified example of a stored procedure I've created. DELIMITER // CREATE
I am running the following command in PHPMyAdmin: DELIMITER # CREATE PROCEDURE addid() BEGIN
I use this code to define my stored procedure CREATE PROCEDURE [dbo].[SP] (@Country NVARCHAR(20))

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.