Vikyath Ram

Vikyath Ram

96 Articles Published

Articles by Vikyath Ram

Page 6 of 10

How do you check if a ResultSet is empty or not in JDBC?

Vikyath Ram
Vikyath Ram
Updated on 21-Feb-2020 8K+ Views

Whenever we execute SQL statements using the executeQuery() method, it returns a ResultSet object which holds the tabular data returned by the SELECT queries(in general).The ResultSet object contains a cursor/pointer which points to the current row. Initially this cursor is positioned before first row (default position).The next() methodThe next() method of the ResultSet interface moves the pointer of the current (ResultSet) object to the next row, from the current position.This method returns a boolean value specifying whether the ResultSet object contains more rows. If there are no rows next to its current position this method returns false, else it returns true.Therefore, ...

Read More

How to extract the last n characters from a string using Java?

Vikyath Ram
Vikyath Ram
Updated on 20-Feb-2020 12K+ Views

To extract last n characters, simply print (length-n)th character to nth character using the charAt() method.ExampleLive Demopublic class ExtractingCharactersFromStrings {    public static void main(String args[]) {           String str = "Hi welcome to tutorialspoint";       int n = 5;       int initial = str.length()-5;       for(int i=initial; i

Read More

How to count the number characters in a Java string?

Vikyath Ram
Vikyath Ram
Updated on 20-Feb-2020 842 Views

Declare an integer, initialize it with 0, in for loop increment it for each character.ExampleLive Demopublic class Sample {    public static void main(String args[]) {       String str = new String("Hi welcome to Tutorialspoint");       int count = 0;       for(int i = 0; i

Read More

In case of FOREIGN KEY constraint, what kind of relationship is there between MySQL parent and child tables?

Vikyath Ram
Vikyath Ram
Updated on 28-Jan-2020 513 Views

The relationship between parent and child table is One-to-Many relationship. It can be understood with the example of two tables named ‘customer’ and ‘orders’. Here, ‘customer’ is the parent table and ‘orders’ is the child table. The relationship is one-to—many because a customer can have more than one order. It can be demonstrated by inserting the values in both the tables as follows −mysql> Select * from Customer; +----+---------+ | id | name    | +----+---------+ | 1  | Gaurav  | | 2  | Raman   | | 3  | Harshit | | 4  | Aarav   | +----+---------+ ...

Read More

Deleting from temporary table in SAP HANA

Vikyath Ram
Vikyath Ram
Updated on 05-Dec-2019 1K+ Views

The temporary tables are session specific. So you would require to use truncate instead of delete as followstruncate table #temptable;Also, could you please check your release? In the recent releases, delete also works fine. Here is an example:Drop table #temptable; Create local temporary table #temptable(id integer, str nvarchar(30)); Insert into #temptable values (1,'abc'); Insert into #temptable values (2,'xyz'); Select * from #temptable;  --> returns 3 rows Delete from #temptable; Select * from #temptable;--> returns 0 rows

Read More

Call screen on clicking the button in SAP ABAP

Vikyath Ram
Vikyath Ram
Updated on 05-Dec-2019 3K+ Views

Please follow the steps below to make it functional.First, open the screen painterNow, double click on the button you want to make functionalAbove “Context Menu Form", you will find a field to enter Functional code where you enter the functional code.This will convert your button to functional trigger theOK code which will run the dynpro “PROCESS AFTER INPUT". Now add a PAI module to this dynpro which indicates the screen you want to call when the button is clicked. Below is the examplecase sy-ucomm. " the ok code   when 'Functioncode’.       call screen screennumber.   when others. ...

Read More

Merging 2 tables with similar column name SAP HANA database

Vikyath Ram
Vikyath Ram
Updated on 05-Dec-2019 616 Views

This can be done by using UNION or UNION ALL operator as followsselect id, Empl_name, DeptId from table1 union select id, Empl_name, DeptId from table2 The difference between UNION and UNION ALL is that UNION removes the duplicates while UNION ALL shows duplicates as well.

Read More

The ResultSet updateRow() method with example

Vikyath Ram
Vikyath Ram
Updated on 30-Jul-2019 2K+ Views

When we execute certain SQL queries (SELECT query in general) they return tabular data.The java.sql.ResultSet interface represents such tabular data returned by the SQL statements.i.e. the ResultSet object holds the tabular data returned by the methods that execute the statements which quires the database (executeQuery() method of the Statement interface in general).The ResultSet object has a cursor/pointer which points to the current row. Initially this cursor is positioned before first row.The updateRow() method of the ResultSet interface updates the contents of the current row to the database. For example if we have updated the values of a particular record using the updateXXX() ...

Read More

Java ResultSetMetaData getColumnTypeName() method with example

Vikyath Ram
Vikyath Ram
Updated on 30-Jul-2019 1K+ Views

The getColumnTypeName() method of the ResultSetMetaData (interface) retrieves and returns the name of the datatype of the specified column in the current ResultSet object.This method accepts an integer value representing the index of a column and, returns a String value representing the name of the SQL data type of the specified column.To get the ResultSetMetaData object, you need to −Register the Driver: Select the required database register the Driver class of the particular database using the registerDriver() method of the DriverManager class or, the forName() method of the class named Class.DriverManager.registerDriver(new com.mysql.jdbc.Driver());Get connection: Create a connection object by passing the URL ...

Read More

Java DatabaseMetaData supportsSavepoints() method with example

Vikyath Ram
Vikyath Ram
Updated on 30-Jul-2019 136 Views

The supportsSavepoints() method of the DatabaseMetaData interface is used to determine whether the underlying database supports savepoints.This method returns a boolean value which is −True, when the underlying database supports savepoints.False, when the underlying database doesn't support savepoints.To determine whether the underlying database supports save points −Make sure your database is up and running.Register the driver using the registerDriver() method of the DriverManager class. Pass an object of the driver class corresponding to the underlying database.Get the connection object using the getConnection() method of the DriverManager class. Pass the URL the database and, user name, password of a user in the ...

Read More
Showing 51–60 of 96 articles
« Prev 1 4 5 6 7 8 10 Next »
Advertisements