Numeric=character varying :operator does not exist based on postgres database The Next CEO of Stack OverflowHow does database indexing work?SQL Server: How to Join to first rowConstraint on a character varying using numberspsql: FATAL: database “<user>” does not existDynamic Postgress Query; ERROR: operator does not exist: character varying = integererror 'function sum(character varying) does not exist' using sum with SQL Alchemy and Postgreserror on altering table column type in postgresql - bigint to character varyingOperator does not exist PostgresERROR: operator does not exist: date >= character varyingOperator Does Not Exist - Postgres & JSON Select Query

Anatomically Correct Strange Women In Ponds Distributing Swords

Is a stroke of luck acceptable after a series of unfavorable events?

Why do professional authors make "consistency" mistakes? And how to avoid them?

Does the Brexit deal have to be agreed by both Houses?

Increase performance creating Mandelbrot set in python

WOW air has ceased operation, can I get my tickets refunded?

How do spells that require an ability check vs. the caster's spell save DC work?

Is it okay to store user locations?

Too much space between section and text in a twocolumn document

Is it my responsibility to learn a new technology in my own time my employer wants to implement?

What can we do to stop prior company from asking us questions?

Inappropriate reference requests from Journal reviewers

How to make a variable always equal to the result of some calculations?

What's the point of interval inversion?

Return the Closest Prime Number

How to get regions to plot as graphics

Customer Requests (Sometimes) Drive Me Bonkers!

Trouble understanding the speech of overseas colleagues

How to make a software documentation "officially" citable?

Would this house-rule that treats advantage as a +1 to the roll instead (and disadvantage as -1) and allows them to stack be balanced?

What is the point of a new vote on May's deal when the indicative votes suggest she will not win?

Implement the Thanos sorting algorithm

If the heap is initialized for security, then why is the stack uninitialized?

Are there languages with no euphemisms?



Numeric=character varying :operator does not exist based on postgres database



The Next CEO of Stack OverflowHow does database indexing work?SQL Server: How to Join to first rowConstraint on a character varying using numberspsql: FATAL: database “<user>” does not existDynamic Postgress Query; ERROR: operator does not exist: character varying = integererror 'function sum(character varying) does not exist' using sum with SQL Alchemy and Postgreserror on altering table column type in postgresql - bigint to character varyingOperator does not exist PostgresERROR: operator does not exist: date >= character varyingOperator Does Not Exist - Postgres & JSON Select Query










0















I have a query like this :



Select office_name, ofc_code 
from table1
where ofc_code in (select ofc_institution from table2 where id ='2')


If i run this i get an error:



Operator does not exist:numeric = character varying
Hint : no operator matches the given name and argument types


In the above query: ofc_code is numeric and ofc_institution is a character varying










share|improve this question




























    0















    I have a query like this :



    Select office_name, ofc_code 
    from table1
    where ofc_code in (select ofc_institution from table2 where id ='2')


    If i run this i get an error:



    Operator does not exist:numeric = character varying
    Hint : no operator matches the given name and argument types


    In the above query: ofc_code is numeric and ofc_institution is a character varying










    share|improve this question


























      0












      0








      0








      I have a query like this :



      Select office_name, ofc_code 
      from table1
      where ofc_code in (select ofc_institution from table2 where id ='2')


      If i run this i get an error:



      Operator does not exist:numeric = character varying
      Hint : no operator matches the given name and argument types


      In the above query: ofc_code is numeric and ofc_institution is a character varying










      share|improve this question
















      I have a query like this :



      Select office_name, ofc_code 
      from table1
      where ofc_code in (select ofc_institution from table2 where id ='2')


      If i run this i get an error:



      Operator does not exist:numeric = character varying
      Hint : no operator matches the given name and argument types


      In the above query: ofc_code is numeric and ofc_institution is a character varying







      sql postgresql






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 21 at 16:44









      a_horse_with_no_name

      306k46468565




      306k46468565










      asked Mar 21 at 16:41









      Stevie Weedy LyngdohStevie Weedy Lyngdoh

      1




      1






















          1 Answer
          1






          active

          oldest

          votes


















          1














          Don't compare apples to oranges. '2' is a string value, 2 is a number.



          You also need to convert ofc_institution to a number if you are certain that it only contains numbers (the question then is: why on earth are you storing numbers in a varchar column?):



          Select office_name, ofc_code 
          from table1
          where ofc_code in (select ofc_institution::numeric
          from table2
          where id = 2);


          If you can't be certain that ofc_institution is always a number, then cast the ofc_code to a string - but that then begs the question why are you comparing those columns to begin with:



          Select office_name, ofc_code 
          from table1
          where ofc_code::varchar in (select ofc_institution
          from table2
          where id = 2);





          share|improve this answer

























          • Yeah i try but still not working... the error is where ofc_code in ...

            – Stevie Weedy Lyngdoh
            Mar 21 at 16:47











          • @StevieWeedyLyngdoh: see my edit. You seem to have a horrible table design if you are comparing apples with oranges

            – a_horse_with_no_name
            Mar 21 at 16:47











          • Yeah i know ..actually the query was written by someone else...i came to fixed those errors... thats y im having a lots of errors in those queries... and i have to do it..its my job... neway thank you for your help..really appreciate it..thanks

            – Stevie Weedy Lyngdoh
            Mar 21 at 16:53






          • 1





            Before properly fixing the queries, please be sure to look at the table structure and understand, that relational databases are not dynamically typed. If you have a psql session, just do a d+ table1 and d+ table2 and look at the data types of columns table1.ofc_code, table2.ofc_institution and table2.id. That should make you understand what is wrong with this query and others.

            – Ancoron
            Mar 21 at 16:57











          • @StevieWeedyLyngdoh: If that answer solved your question then please accept it, so that your question is marked as resolved.

            – a_horse_with_no_name
            Mar 22 at 6:56











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55285326%2fnumeric-character-varying-operator-does-not-exist-based-on-postgres-database%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          Don't compare apples to oranges. '2' is a string value, 2 is a number.



          You also need to convert ofc_institution to a number if you are certain that it only contains numbers (the question then is: why on earth are you storing numbers in a varchar column?):



          Select office_name, ofc_code 
          from table1
          where ofc_code in (select ofc_institution::numeric
          from table2
          where id = 2);


          If you can't be certain that ofc_institution is always a number, then cast the ofc_code to a string - but that then begs the question why are you comparing those columns to begin with:



          Select office_name, ofc_code 
          from table1
          where ofc_code::varchar in (select ofc_institution
          from table2
          where id = 2);





          share|improve this answer

























          • Yeah i try but still not working... the error is where ofc_code in ...

            – Stevie Weedy Lyngdoh
            Mar 21 at 16:47











          • @StevieWeedyLyngdoh: see my edit. You seem to have a horrible table design if you are comparing apples with oranges

            – a_horse_with_no_name
            Mar 21 at 16:47











          • Yeah i know ..actually the query was written by someone else...i came to fixed those errors... thats y im having a lots of errors in those queries... and i have to do it..its my job... neway thank you for your help..really appreciate it..thanks

            – Stevie Weedy Lyngdoh
            Mar 21 at 16:53






          • 1





            Before properly fixing the queries, please be sure to look at the table structure and understand, that relational databases are not dynamically typed. If you have a psql session, just do a d+ table1 and d+ table2 and look at the data types of columns table1.ofc_code, table2.ofc_institution and table2.id. That should make you understand what is wrong with this query and others.

            – Ancoron
            Mar 21 at 16:57











          • @StevieWeedyLyngdoh: If that answer solved your question then please accept it, so that your question is marked as resolved.

            – a_horse_with_no_name
            Mar 22 at 6:56















          1














          Don't compare apples to oranges. '2' is a string value, 2 is a number.



          You also need to convert ofc_institution to a number if you are certain that it only contains numbers (the question then is: why on earth are you storing numbers in a varchar column?):



          Select office_name, ofc_code 
          from table1
          where ofc_code in (select ofc_institution::numeric
          from table2
          where id = 2);


          If you can't be certain that ofc_institution is always a number, then cast the ofc_code to a string - but that then begs the question why are you comparing those columns to begin with:



          Select office_name, ofc_code 
          from table1
          where ofc_code::varchar in (select ofc_institution
          from table2
          where id = 2);





          share|improve this answer

























          • Yeah i try but still not working... the error is where ofc_code in ...

            – Stevie Weedy Lyngdoh
            Mar 21 at 16:47











          • @StevieWeedyLyngdoh: see my edit. You seem to have a horrible table design if you are comparing apples with oranges

            – a_horse_with_no_name
            Mar 21 at 16:47











          • Yeah i know ..actually the query was written by someone else...i came to fixed those errors... thats y im having a lots of errors in those queries... and i have to do it..its my job... neway thank you for your help..really appreciate it..thanks

            – Stevie Weedy Lyngdoh
            Mar 21 at 16:53






          • 1





            Before properly fixing the queries, please be sure to look at the table structure and understand, that relational databases are not dynamically typed. If you have a psql session, just do a d+ table1 and d+ table2 and look at the data types of columns table1.ofc_code, table2.ofc_institution and table2.id. That should make you understand what is wrong with this query and others.

            – Ancoron
            Mar 21 at 16:57











          • @StevieWeedyLyngdoh: If that answer solved your question then please accept it, so that your question is marked as resolved.

            – a_horse_with_no_name
            Mar 22 at 6:56













          1












          1








          1







          Don't compare apples to oranges. '2' is a string value, 2 is a number.



          You also need to convert ofc_institution to a number if you are certain that it only contains numbers (the question then is: why on earth are you storing numbers in a varchar column?):



          Select office_name, ofc_code 
          from table1
          where ofc_code in (select ofc_institution::numeric
          from table2
          where id = 2);


          If you can't be certain that ofc_institution is always a number, then cast the ofc_code to a string - but that then begs the question why are you comparing those columns to begin with:



          Select office_name, ofc_code 
          from table1
          where ofc_code::varchar in (select ofc_institution
          from table2
          where id = 2);





          share|improve this answer















          Don't compare apples to oranges. '2' is a string value, 2 is a number.



          You also need to convert ofc_institution to a number if you are certain that it only contains numbers (the question then is: why on earth are you storing numbers in a varchar column?):



          Select office_name, ofc_code 
          from table1
          where ofc_code in (select ofc_institution::numeric
          from table2
          where id = 2);


          If you can't be certain that ofc_institution is always a number, then cast the ofc_code to a string - but that then begs the question why are you comparing those columns to begin with:



          Select office_name, ofc_code 
          from table1
          where ofc_code::varchar in (select ofc_institution
          from table2
          where id = 2);






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Mar 21 at 16:47

























          answered Mar 21 at 16:44









          a_horse_with_no_namea_horse_with_no_name

          306k46468565




          306k46468565












          • Yeah i try but still not working... the error is where ofc_code in ...

            – Stevie Weedy Lyngdoh
            Mar 21 at 16:47











          • @StevieWeedyLyngdoh: see my edit. You seem to have a horrible table design if you are comparing apples with oranges

            – a_horse_with_no_name
            Mar 21 at 16:47











          • Yeah i know ..actually the query was written by someone else...i came to fixed those errors... thats y im having a lots of errors in those queries... and i have to do it..its my job... neway thank you for your help..really appreciate it..thanks

            – Stevie Weedy Lyngdoh
            Mar 21 at 16:53






          • 1





            Before properly fixing the queries, please be sure to look at the table structure and understand, that relational databases are not dynamically typed. If you have a psql session, just do a d+ table1 and d+ table2 and look at the data types of columns table1.ofc_code, table2.ofc_institution and table2.id. That should make you understand what is wrong with this query and others.

            – Ancoron
            Mar 21 at 16:57











          • @StevieWeedyLyngdoh: If that answer solved your question then please accept it, so that your question is marked as resolved.

            – a_horse_with_no_name
            Mar 22 at 6:56

















          • Yeah i try but still not working... the error is where ofc_code in ...

            – Stevie Weedy Lyngdoh
            Mar 21 at 16:47











          • @StevieWeedyLyngdoh: see my edit. You seem to have a horrible table design if you are comparing apples with oranges

            – a_horse_with_no_name
            Mar 21 at 16:47











          • Yeah i know ..actually the query was written by someone else...i came to fixed those errors... thats y im having a lots of errors in those queries... and i have to do it..its my job... neway thank you for your help..really appreciate it..thanks

            – Stevie Weedy Lyngdoh
            Mar 21 at 16:53






          • 1





            Before properly fixing the queries, please be sure to look at the table structure and understand, that relational databases are not dynamically typed. If you have a psql session, just do a d+ table1 and d+ table2 and look at the data types of columns table1.ofc_code, table2.ofc_institution and table2.id. That should make you understand what is wrong with this query and others.

            – Ancoron
            Mar 21 at 16:57











          • @StevieWeedyLyngdoh: If that answer solved your question then please accept it, so that your question is marked as resolved.

            – a_horse_with_no_name
            Mar 22 at 6:56
















          Yeah i try but still not working... the error is where ofc_code in ...

          – Stevie Weedy Lyngdoh
          Mar 21 at 16:47





          Yeah i try but still not working... the error is where ofc_code in ...

          – Stevie Weedy Lyngdoh
          Mar 21 at 16:47













          @StevieWeedyLyngdoh: see my edit. You seem to have a horrible table design if you are comparing apples with oranges

          – a_horse_with_no_name
          Mar 21 at 16:47





          @StevieWeedyLyngdoh: see my edit. You seem to have a horrible table design if you are comparing apples with oranges

          – a_horse_with_no_name
          Mar 21 at 16:47













          Yeah i know ..actually the query was written by someone else...i came to fixed those errors... thats y im having a lots of errors in those queries... and i have to do it..its my job... neway thank you for your help..really appreciate it..thanks

          – Stevie Weedy Lyngdoh
          Mar 21 at 16:53





          Yeah i know ..actually the query was written by someone else...i came to fixed those errors... thats y im having a lots of errors in those queries... and i have to do it..its my job... neway thank you for your help..really appreciate it..thanks

          – Stevie Weedy Lyngdoh
          Mar 21 at 16:53




          1




          1





          Before properly fixing the queries, please be sure to look at the table structure and understand, that relational databases are not dynamically typed. If you have a psql session, just do a d+ table1 and d+ table2 and look at the data types of columns table1.ofc_code, table2.ofc_institution and table2.id. That should make you understand what is wrong with this query and others.

          – Ancoron
          Mar 21 at 16:57





          Before properly fixing the queries, please be sure to look at the table structure and understand, that relational databases are not dynamically typed. If you have a psql session, just do a d+ table1 and d+ table2 and look at the data types of columns table1.ofc_code, table2.ofc_institution and table2.id. That should make you understand what is wrong with this query and others.

          – Ancoron
          Mar 21 at 16:57













          @StevieWeedyLyngdoh: If that answer solved your question then please accept it, so that your question is marked as resolved.

          – a_horse_with_no_name
          Mar 22 at 6:56





          @StevieWeedyLyngdoh: If that answer solved your question then please accept it, so that your question is marked as resolved.

          – a_horse_with_no_name
          Mar 22 at 6:56



















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55285326%2fnumeric-character-varying-operator-does-not-exist-based-on-postgres-database%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

          은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현