0

I am developing a application in Codeigniter Framework and I have been created a model with name "Surveyor_model" and I am trying to execute query but it is not executing and give a message "table or view does not exist."

I have been create a model in codeigniter with name " Surveyor_model" and I am trying to execute a query with syntax

        $this->oracle_db->get('users_surveyor');

But it is showing a query as given below

    select * from "users_surveyor"

and showing a error message "Table or view does not exist"

I want to remove double quotation from a query as given below

       select * from "users_surveyor"

so please tell me how can I remove double quotation.

And my I am also showing a database config and please see as given below

   $dbtns = "(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 10.9.1.217)(PORT = 1521)) (CONNECT_DATA = (SERVICE_NAME = orcl) (SID = orcl)))"; 


     $active_group = 'oracle';
     $query_builder = TRUE;

   $db['oracle'] = array(
'dsn'   => '',
'hostname' => $dbtns,
//'username' => 'igistest', 
//'password' => 'igistest',
'username' => 'cwms', 
'password' => 'cwms321',

'database' => 'orcl',
'dbdriver' => 'oci8',
'dbprefix' => '',
'pconnect' => FALSE,
'db_debug' => (ENVIRONMENT !== 'production'),
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'encrypt' => FALSE,
'compress' => FALSE,
'stricton' => FALSE,
'failover' => array(),
'save_queries' => TRUE
   );
  • Are you using the correct driver? Because I see you model is called Oracle. – lcssanches Apr 11 '19 at 11:35
  • when I execute query with my mysql database then it is working while when I execute query with Oracle database it is not working and also I would like to tell you that when I use this methd like $this->oracle_db->query("select * users_surveyor'); – farhan ahmed Apr 11 '19 at 17:23
  • Show your database config. – lcssanches Apr 11 '19 at 17:26
  • and also I would like to tell you that when I use this method like $this->oracle_db->get("select * users_surveyor'); instead of $this->oracle_db->get('users_surveyor'); then it is working please tell me reason why is it not working with this method $this->oracle_db->get('users_surveyor'); – farhan ahmed Apr 11 '19 at 17:26
  • Edit you question and add your database config. – lcssanches Apr 11 '19 at 17:30

1 Answers1

0

Form this post you can use.

SET GLOBAL SQL_MODE=ANSI_QUOTES;

For more information you can read this article Link.

Shahriar63
  • 58
  • 1
  • 8
  • I would like to tell you that I am working on oracle database with codeigniter framework.Please tell me solution – farhan ahmed Apr 12 '19 at 07:28
  • You can read this github [link](https://github.com/tgriesser/knex/issues/2219#issuecomment-328134588). From their discussion you can type the table name as uppercase to run the query. – Shahriar63 Apr 16 '19 at 06:03