Menu
Question Index
...


Write a program to create the insert statement for oracle. If present, the id field should be placed at the beginning and the rest of fields should be sorted.

Input (Object) Output (String)
College object
------------------
Number of Students=75896
Number of Branches=6
Number of Faculty=1200
College Code="RITA"
Address="B K Samudram Mandal-Anantapur"
College Name="Srinivasa Ramanujan Institute of Technology"
INSERT INTO COLLEGE(ADDRESS, COLLEGECODE, COLLEGENAME, NUMBEROFBRANCHES, NUMBEROFFACULTY, NUMBEROFSTUDENTS) VALUES("B K SAMUDRAM MANDAL-ANANTAPUR", "RITA", "SRINIVASA RAMANUJAN INSTITUTE OF TECHNOLOGY", 6, 1200, 75896);
Student object
------------------
Gender=true
Id=15
Section='A'
Name="Kiran"
Marks=1100
Percentage=98.9
INSERT INTO STUDENT(ID, GENDER, MARKS, NAME, PERCENTAGE, SECTION) VALUES(15, TRUE, 1100, "KIRAN", 98.9, 'A');
Employee object
------------------
Salary=200000
Name="Narayana"
Designation="Software Engineer"
Id=2516
Gender=true
INSERT INTO EMPLOYEE(ID, DESIGNATION, GENDER, NAME, SALARY) VALUES(2516, "SOFTWARE ENGINEER", TRUE, "NARAYANA", 200000.0);
Mobile object
------------------
Company Name="Samsung"
Model Name="GT-S6102"
Price=8500
Memory=160
Pixel=3.2f
Resolution="240 x 320"
INSERT INTO MOBILE(COMPANYNAME, MEMORY, MODELNAME, PIXEL, PRICE, RESOLUTION) VALUES("SAMSUNG", 160.0, "GT-S6102", 3.2, 8500.0, "240 X 320");

class InsertQueryForOracle

{    public static void main(String s[])
    {
        College college = new College();
        college.numberOfStudents = 75896;
        college.numberOfBranches = 6;
        college.numberOfFaculty = 1200;
        college.collegeCode = "RITA";
        college.address = "B K Samudram Mandal-Anantapur";
        college.collegeName = "Srinivasa Ramanujan Institute of Technology";
        String query = insertValues(college);
        System.out.println(query);

    }


public static String insertValues(Object object) {
String result = null;
//Write code here to create the insert statement query
return result;
}

//If required write any additional methods here
}
class Student {

String name;
boolean gender;
int marks;
double percentage;
char section;
int id;
}

class Employee {

double salary;
String name;
String designation;
int id;
boolean gender;
}

class Mobile {

String companyName;
String modelName;
double price;
double memory;
float pixel;
String resolution;
}

class College {

int numberOfStudents;
int numberOfBranches;
int numberOfFaculty;
String collegeCode;
String address;
String collegeName;
}

Doubts

Problems

Topic: Other Advanced Topics In Java

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App