column « SQL « Java Database Q&A





1. Add description to columns using Java code    stackoverflow.com

I can create a table and its columns in Java by using the statement:

CREATE TABLE table_name(column1 int, column2 double, etc...)
What I would like to do is to add descriptions to each ...

2. Getting "The column name xxx is not valid" exception when trying to combine columns    stackoverflow.com

I am trying to combine two columns in SQL query but getting the following exception in java.sql.ResultSet's FindColumn method:

JdbcSqlException: The column name FullName is not valid. Column: ...

3. Avoiding column name redundancy accessing SQL databases?    stackoverflow.com

I'm working on a program using a SQL database (I use SQLite). What my program does is the following:

  1. Creates the tables in the database if they don't exist (on startup)
  2. Executes SQL ...

4. How to check column value is null or not in plsql?    stackoverflow.com

I have a table with name Shipment which has columns HAWB, MAWB. How can I check that these two columns are having null value or not ?.

5. getting column names in JDBC    stackoverflow.com

I was wondering how to tell if a column with a certain name exists in a certain database table. I'm using JDBC but if it can be done with pure SQL, ...

6. getColumnCount does not count the column when its value is null?    stackoverflow.com

I have this code:

// Get the results
while(rs.next())
{
    resultList = new JSONObject();
    for(int i = 1; i <= rsmd.getColumnCount(); i++)
    {
   ...

7. Java SQL how to get value from a column?    stackoverflow.com

Nice to meet you all! I wanna get value from a column with the simple following code:

String statement = "select rated,vote_count from iptv_media_source where channel_id= '"
      ...

8. how to get column information for a given sql string    coderanch.com

I have an sql string (with placeholders ('?') )as an input into my code. I am trying to generate query classes based on this input sql. I need to figure out what the columns are that this sql string is looking for, and from which tables. Is there any method(s) in JDBC to which I can pass in this sql string ...

9. java.sql.SQLException: ORA-06550: line 1, column 13    coderanch.com

Nadjim, According to your error message, the problem is not with your java code (that invokes the "myrecrtn()" procedure), but with the "myrecrtn()" procedure itself. It looks like the "myrecrtn()" procedure is a java stored procedure, correct? Can you successfully execute "myrecrtn()" from SQL*Plus? Would it be possible to see the code for "myrecrtn()"? Cheers, Avi.





11. SQL for the top 2 most recurring values in a column    coderanch.com

Hi All, How could I go about writing a SQL statement to find top 2 values that recurr most in a column? Say a table has one column, and that column can have, say one of the 5 values, A, B, C, D or E repeated any number of time. How can I find out the two values with the most ...

13. Regex: Infinite recurssion when extracting columns from SQL    coderanch.com

I am trying to get all the columns within a SQL query (including the sub selects). When the code hits matcher.find(). i get the following exception: Exception in thread "main" java.lang.StackOverflowError at java.util.regex.Pattern$Branch.match(Pattern.java: 4530) at java.util.regex.Pattern$GroupHead.match(Pattern.ja va:4570) I am not sure where in the regex is causing the inifinite recursion. Can anyone shed light on this? String regex = "^select(([^\\(]|\\([^\\(]+\\))*)from"; Pattern ...

14. Infinite recurssion when using Regex to extract column names from SQL    coderanch.com

I am trying to get all the columns within a SQL query (including the sub selects). When the code hits matcher.find(). i get the following exception: Exception in thread "main" java.lang.StackOverflowError at java.util.regex.Pattern$Branch.match(Pattern.java: 4530) at java.util.regex.Pattern$GroupHead.match(Pattern.ja va:4570) I am not sure where in the regex is causing the inifinite recursion. Can anyone shed light on this? String regex = "^select(([^\\(]|\\([^\\(]+\\))*)from"; Pattern ...

15. Error in retrieving data using java from Column whose name is a reserved word in SQL    coderanch.com

Hi Guys I struck at some point of my developement. I have a table from where i am pulling the data, But the table has one column whose name is a reserved word. when i am trying to use that column name i am getting an SQL exception. MISSING EXPRESSION, Here is my code; Any help would greatly appriciated. [CODE] try ...

16. SQL - Automatically reflecting the values of 2 columns in another column    coderanch.com

Hi! I need some help in implementing a SQL query. I have a table Users with 3 columns: FIRST_NAME, LAST_NAME, FULL_NAME FIRST_NAME VARCHAR(30) NOT NULL LAST_NAME VARCHAR(30) NOT NULL FULL_NAME VARCHAR(60) UNIQUE I'm inserting values into first 2 columns: INSERT INTO USERS(FIRST_NAME, LAST_NAME) VALUES ('JAMES', 'GOSLING'); That's perfect. However, here comes interesting part: The column 'FULL_NAME' should automatically get the value ...





17. 'java.sql.SQLException: Out of range value for column' error    coderanch.com

Quoting from MySql 5.1 ref manual, Paragraph 10.2 Numeric Types When asked to store a value in a numeric column that is outside the data type's permissible range, MySQL's behavior depends on the SQL mode in effect at the time. For example, if no restrictive modes are enabled, MySQL clips the value to the appropriate endpoint of the range and stores ...

18. java.sql.SQLException: Column not found    dbforums.com

I get this error when attempting to do a SELECT * FROM Mytable in Access. Even if I insert a field name, it gives me an error. The question: Is there an Access secret field name calling syntax i'm missing? Can someone fill me in please? My first ODBC-JDBC port to Access... I'm already hating it. I hate access.

19. java.sql.SQLException: Column not found    forums.oracle.com

"select max(sno) from staffdetail" will give u max of sno. column for this result will be 'max' ( it depends on the DB u r using ), So it's better if u rename that result colulmn. Something like this. - "select max(sno) maxsno from staffdetail" In code u have to this name while reading the resultset.,i.e. rs.getInt("maxsno");

20. Embedded Single Quote in SQL Column truncates Java String    forums.oracle.com

Thank you for pointing out the security risks here. It is something I will work to incorporate more fully into my code. In this particular case though, the user is not doing data entry. The data being retrieved from the database was not entered by the user, this data was imported by the conference administrator for use in in the registration ...