Questions tagged [string-constant]

String constans refer to quoted string literals, or in some languages also to constant expressions formed from them, usually via concatenation.

79 questions
0
votes
2 answers

Dynamically read value of string array from constant in Java

I want to read value of a string array constant dynamically. Constant class has string array of car. NeedValueOf will dynamically append with constant name i.e Constants.needValueOf Tell me the way to get value dynamic and after getting object i…
Amol
  • 7
  • 4
0
votes
1 answer

react native project structure with constants folder

what is considered the best practice for string constants constants used throughout the entire application such as constants used in home screen and others, would it be considered good practice to combine them all in one file or to have multiple…
NQQ
  • 51
  • 1
  • 5
0
votes
1 answer

Non-computed column does not exist after WHERE clause in Postgres, even though it exists in the DB

Using the following code: SELECT * FROM users u JOIN sales s ON u.id = s.user_id WHERE u.name = "Guest" AND s.removed = false; Postgres throws an error saying column "Guest" does not exist, even if I put name in quotes, and yet if I remove that…
0
votes
1 answer

postgresSQL: column doesn't exist, when trying to insert into table

when I run this in terminal: INSERT INTO signup (username, user_password) VALUES("John", "dqw1"); It gives me: ERROR: column "John" does not exist. What could be the problem here? this doesn't even make sense, the column name is username. "John"…
0
votes
2 answers

How to test in select clause using CASE if a value pertains to a list of predefined string in Postgresql

I'd like to write postgresql code that defines a table B based on table A values, according to A field of string type named d, if it matches any element of predefined string lists. Table A contains 2 fields: c and d, d is a string. Here is what I've…
0
votes
0 answers

Including an apostrophe in a name without causing a syntax error

I'm trying to generate a script to enter data into a database although I've come across an issue with names containing an apostrophe. For example: INSERT INTO people(firstname, lastname) VALUES ('Mark', 'O'something'); The name containing the…
SkinnyBetas
  • 461
  • 1
  • 5
  • 27
0
votes
1 answer

Why I change the string s1 constant by reflection in java, the other s2, s3 also changed?

environment messages: (env) λ java -version openjdk version "1.8.0_242" OpenJDK Runtime Environment (build 1.8.0_242-xxxxxx_JDK_xxxxx) OpenJDK 64-Bit Server VM (build 25.242-b08, mixed mode) /* * Copyright (c) Google Technologies Co., Ltd.…
Clarence
  • 19
  • 5
0
votes
3 answers

Unable to add a text value in PostgreSQL

I get an error when inserting data into a text column using "", when I delete the quotes then postgres run and add the column with 0 value. INSERT INTO tablex (dates, times, openp, high, low, closep, volume) VALUES ("03/08/2021", 2300, 1680, 1688.6,…
CacheKatch
  • 13
  • 4
0
votes
1 answer

PostgreSQL where clause condition check with value that contains single quote

Suppose I have an employees table in Postgres DB where I have to insert a value for an employee name which is john's Since it's Postgres I will escape the single quote ' by doubling them up -> '' So john's will become john''s Now when I select that…
ahmedshahriar
  • 1,053
  • 7
  • 25
0
votes
1 answer

Postgres: strings in column during update ERROR: syntax error at or near

I am trying to update a value in my Postgres table: CREATE TABLE restaurants ( id BIGSERIAL NOT NULL, name VARCHAR(50) NOT NULL, location VARCHAR(50) NOT NULL, price_range INT NOT NULL CHECK (price_range >= 1 AND price_range…
Emma N
  • 1
  • 2
0
votes
0 answers

postgresql trigger function add if statement that compares old column value with a default value on update

I want to create a trigger function in sql that would prevent update on a column in a table if the column value was not equal to "default_id". For example, if I update a row where some_id equals to "default_id", it would succeed. However, if I…
PBandJ
  • 2,537
  • 3
  • 21
  • 31
0
votes
2 answers

PostgreSQL INSERT INTO return ERROR: column "***" does not exist

I want to insert a row "India", "Aditya Birla Capital Ltd", "INE674K01013", "INR", "ADTB","Aditya Birla Capital" to table shares."shareNames". This is the postgresql code: INSERT INTO shares."shareNames" ("country", "full_name", "isin_code",…
Mainak
  • 1
  • 2
0
votes
5 answers

string.concat(string) function, why my code is giving false in the output

String s1="Hello"; s1=s1.concat("World"); String s2="HelloWorld"; System.out.println(s1); System.out.println(s2); System.out.println(s2==s1); //false As after concatenating, the "HelloWorld" string is created in the string constant pool and we…
0
votes
0 answers

Error in data insertion in heroku psql table using heroku CLI

I am using Heroku CLI to insert data in a database table. I have table name review and these are the columns of it :- (date,verified_reveiws,total_reviews). You can see it in provided image also. when I am executing insert command INSERT INTO review…
Kishan Yadav
  • 86
  • 1
  • 8
0
votes
0 answers

Postgres column "value" does not exist

I'm building a command that will execute a direct psql query on an operating system (Ubuntu) command line. Strangely enough the following error always occurs: ERROR: column "value" does not exist. However, the query works if you are directly logged…