SQL query and force close challenge - android

here i tried to take name and password from database if the user have already an account, or sign up him by enter his data.
This is the first activity which has force close by clicking on first button to log into the data base
public class SelesMeter2Activity extends Activity implements OnClickListener {
EditText ed1;
EditText ed2;
Button b1;
Button b2;
SQLiteDatabase sql;
Cursor c;
Intent in;
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
ed1 = (EditText) findViewById(R.id.ed1);
ed2 = (EditText) findViewById(R.id.ed2);
b1 = (Button) findViewById(R.id.bt1);
b2 = (Button) findViewById(R.id.bt2);
b1.setOnClickListener(this);
b2.setOnClickListener(this);
sql = openOrCreateDatabase("db", 0, null);
sql.execSQL("CREATE TABLE if not exists "
+ "Employee2 (password integer NOT NULL PRIMARY KEY,name text NOT NULL)");
}
#Override
public void onClick(View arg0) {
// log in
if (arg0.getId() == R.id.bt1) {
int p = 0;
String name = ed1.getText().toString();
String sp = ed2.getText().toString();
try {
// Attempt to parse the number as an integer
p = Integer.parseInt(sp);
} catch (NumberFormatException nfe) {
// parseInt failed, so tell the user it's not a number
Toast.makeText(this,
"Sorry, " + sp + " is not a number. Please try again.",
Toast.LENGTH_LONG).show();
}
if (c.getCount() != 0) {
c = sql.rawQuery("select * from Employee", null);
while (c.moveToNext()) {
if (name.equals("c.getString(1)") && p == c.getInt(0)) {
in = new Intent(this, secondview.class);
startActivity(in);
break;
}
}
}
else {
Toast.makeText(this,
"please sign up first or enter " + "correct data", 2000)
.show();
}
} else if (arg0.getId() == R.id.bt2) {
// sign up
Intent in2 = new Intent(this, signup.class);
startActivity(in2);
}
}
}
the second class that enter the new user which is not working as expected,
the toast does not work :
public class signup extends Activity implements OnClickListener {
EditText e1;
EditText e2;
SQLiteDatabase sql;
Button b;
#Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.singupx);
Intent in = getIntent();
e1 = (EditText) findViewById(R.id.ed1s);
e2 = (EditText) findViewById(R.id.ed2s);
b = (Button) findViewById(R.id.bt1s);
b.setOnClickListener(this);
}
#Override
public void onClick(View v) {
String n = e1.getText().toString();
String sp = e2.getText().toString();
try {
// Attempt to parse the number as an integer
int p = Integer.parseInt(sp);
// This insertion will *only* execute if the parseInt was successful
// sql.execSQL("insert into Employee2(password,name)values('"+n+"',"+p+")");
ContentValues values = new ContentValues();
values.put("password", p);
values.put("name", n);
sql.insert("Employee2", null, values);
Toast.makeText(this, "Data inserted", Toast.LENGTH_LONG).show();
Intent in2 = new Intent(this, secondview.class);
startActivity(in2);
} catch (NumberFormatException nfe) {
// parseInt failed, so tell the user it's not a number
Toast.makeText(this,
"Sorry, " + sp + " is not a number. Please try again.",
Toast.LENGTH_LONG).show();
}
}
}

In the SelesMeter2Activity you'll have a NullPointerException at the line:
if (c.getCount() != 0) {
as you don't initialize the Cursor before that line. Move the query before the above line:
c = sql.rawQuery("select * from Employee", null);
if (c.getCount() != 0) {
// ...
You should post the exception you get from the logcat.
Also regarding your signup activity please don't instantiate the first activity to access fields from it. Open the database again in the second activity and insert the values.

This is why you are getting error
// you are calling the `c.getCount();` before you are assigning
// It will throw null pointer exception
if (c.getCount() != 0) {
c = sql.rawQuery("select * from Employee", null);
while (c.moveToNext()) {
if (name.equals(c.getString(1)) && p == c.getInt(0)) {
in = new Intent(this, secondview.class);
startActivity(in);
break;
}
}
}
Change the logic like
c = sql.rawQuery("select * from Employee", null);
c.moveToFirst();
if(!c.isAfterLast()) {
do {
if (name.equals(c.getString(1)) && p == c.getInt(0)) {
in = new Intent(this, secondview.class);
startActivity(in);
break;
}
} while (c.moveToNext());
}
and name.equals("c.getString(1)") should be name.equals(c.getString(1))
EDIT
Example of insert method
ContentValues values = new ContentValues();
values.put("password", n);
values.put("name", p);
database.insert("Employee2", null, values);

Related

SQLiteLog no such table in android using Sqllite Database

By using assets folder, we are reading data i.e,address details based on search keyword:
Here is my code
private SQLiteDatabase db;
private Cursor c;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
et_search = (EditText) findViewById(R.id.et_search);
img = (ImageView) findViewById(R.id.img_search);
list = (ListView) findViewById(R.id.list_search);
db = openOrCreateDatabase("sample", Context.MODE_PRIVATE, null);
img.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
search_keyword = et_search.getText().toString();
arr_data = new ArrayList<ListItems>();
if (isValid()) {
SELECT_SQL = "SELECT ROWID AS _id,* FROM Addresses where Type LIKE '%" + search_keyword + "%'";
Log.d("daatt",SELECT_SQL);
try {
c = db.rawQuery(SELECT_SQL, null);
c.moveToFirst();
showRecords();
} catch (SQLiteException e) {
Toast.makeText(getApplicationContext(), "No Data", Toast.LENGTH_LONG).show();
}
}
}
});
}
private void showRecords() {
String ugName = c.getString(c.getColumnIndex("Name"));
String ugaddress = c.getString(c.getColumnIndex("Address"));
String ugtype = c.getString(c.getColumnIndex("Type"));
ListItems items = new ListItems();
// Finish reading one raw, now we have to pass them to the POJO
items.setName(ugName);
items.setAddress(ugaddress);
items.setType(ugtype);
// Lets pass that POJO to our ArrayList which contains undergraduates as type
arr_data.add(items);
}
ListDataAdapter adapter = new ListDataAdapter(arr_data);
list.setAdapter(adapter);
if (c != null && !c.isClosed()) {
int count = c.getCount();
c.close();
}
Log.d("ListData", "" + arr_data);
}
private boolean isValid() {
if (search_keyword.length() == 0) {
Toast.makeText(getApplicationContext(), "please enter valid key word", Toast.LENGTH_LONG).show();
return false;
}
return true;
}
For 1st build we got successful data loaded using list adapter
But after clean project, & Rebuild project showing a no such table expection
Please guide us wr we r going wrong
Advance Thanks
As far as I can see from your print, the table you're referring to is called ListOfAddress, ain't it? your SQL is:
SELECT_SQL = "SELECT ROWID AS _id,* FROM Addresses where Type LIKE '%" + search_keyword + "%'";
I might be wrong, but I would double check the query.

Void cannot be converted to string [duplicate]

This question already has an answer here:
What does "Incompatible types: void cannot be converted to ..." mean?
(1 answer)
Closed 4 years ago.
Im trying to create a simple login for my mobile app but im getiing stock with an error :
Login.java
public void onButtonClick(View v) {
if (v.getId() == R.id.BLogin) {
EditText a = (EditText) findViewById(R.id.TFusername);
String str = a.getText().toString();
EditText b = (EditText) findViewById(R.id.TFpassword);
String pass = b.getText().toString();
String password = helper.searchPass(str);
if (pass.equals(password)) {
Intent i = new Intent(LogIn.this, Display.class);
i.putExtra("Username", str);
startActivity(i);
} else {
Toast temp = Toast.makeText(LogIn.this, "Username and password don't match!", Toast.LENGTH_SHORT);
temp.show();
}
}
if (v.getId() == R.id.BSignup) {
Intent i = new Intent(LogIn.this, Signup.class);
startActivity(i);
}
}
and the DatabaseHandler
public void searchPass(String uname)
{
db = this.getReadableDatabase();
String query = " select uname, pass from "+TABLE_NAME;
Cursor cursor = db.rawQuery(query , null);
String a, b;
b = "not found";
if(cursor.moveToFirst())
{
do {
a = cursor.getString(0);
if(a.equals(uname))
{
b = cursor.getString(1);
break;
}
}
while (cursor.moveToNext());
}
return b;
}
Im getting stuck with the error:
Error:(32, 48) error: incompatible types: void cannot be converted to String
String password = helper.searchPass(str);
anyone know what im missing?
Replace return type as String in your method searchPass
public String searchPass(String uname)
{
db = this.getReadableDatabase();
String query = " select uname, pass from "+TABLE_NAME;
Cursor cursor = db.rawQuery(query , null);
String a, b;
b = "not found";
if(cursor.moveToFirst())
{
do {
a = cursor.getString(0);
if(a.equals(uname))
{
b = cursor.getString(1);
break;
}
}
while (cursor.moveToNext());
}
return b;
}

Adding database enteries to list view

I am creating a database within my android application that allows users to enter assignment information. At the moment the information is stored but not listed as I would like. I am looking to add function to the View Assignments button so that it returns to the AssignmentsManager page and lists the entered assignments.
I believe I will have to use something like;
listView=(ListView)findViewById(R.id.listView1); //initialise the listview
listAdapter= new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1,0); //initialise an ArrayAdapter
listView.setAdapter(listAdapter); //set the adapter to the listview
And to add assignments to list;
listAdapter.add(c.getString(0)+c.getString(1)+c.getString(2)+c.getString(3)+c.getString(4));
I am unsure how to implement this though. Below is my class to add the assignments;
public class addassignment extends Activity {
DBAdapter db = new DBAdapter(this);
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.add);
}
public void addAssignment(View v) {
Log.d("test", "adding");
// get data from form
EditText nameTxt = (EditText) findViewById(R.id.editTitle);
EditText dateTxt = (EditText) findViewById(R.id.editDuedate);
EditText courseTxt = (EditText) findViewById(R.id.editCourse);
EditText notesTxt = (EditText) findViewById(R.id.editNotes);
db.open();
long id = db.insertRecord(nameTxt.getText().toString(), dateTxt
.getText().toString(), courseTxt.getText().toString(), notesTxt
.getText().toString());
db.close();
nameTxt.setText("");
dateTxt.setText("");
courseTxt.setText("");
notesTxt.setText("");
Toast.makeText(addassignment.this, "Assignment Added",
Toast.LENGTH_LONG).show();
}
public void viewAssignments(View v) {
Intent i = new Intent(this, AssignmentManager.class);
startActivity(i);
}
}
Here is the Assignments Class where the list should be displayed;
public class AssignmentManager extends Activity {
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.assignmentmanager);
Button addBtn = (Button) findViewById(R.id.add);
addBtn.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
Intent i = new Intent(AssignmentManager.this,
addassignment.class);
startActivity(i);
}
});
try {
String destPath = "/data/data/" + getPackageName()
+ "/databases/AssignmentDB";
File f = new File(destPath);
if (!f.exists()) {
CopyDB(getBaseContext().getAssets().open("mydb"),
new FileOutputStream(destPath));
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
DBAdapter db = new DBAdapter(this);
// ---add an assignment---
db.open();
long id = db.insertRecord("Android App", "14/02/2015", "Networks",
"First Android Project");
id = db.insertRecord("Java Development", "5/02/2015", "Java",
"Complete Assignment");
db.close();
// ---get all Records---
db.open();
Cursor c = db.getAllRecords();
if (c.moveToFirst()) {
do {
DisplayRecord(c);
} while (c.moveToNext());
}
db.close();
/*
* //---get a Record--- db.open(); Cursor c = db.getRecord(2); if
* (c.moveToFirst()) DisplayRecord(c); else Toast.makeText(this,
* "No Assignments found", Toast.LENGTH_LONG).show(); db.close();
*/
// ---update Record---
/*
* db.open(); if (db.updateRecord(1, "Android App", "29/02/2015",
* "Networks", "First Android Project")) Toast.makeText(this,
* "Update successful.", Toast.LENGTH_LONG).show(); else
* Toast.makeText(this, "Update failed.", Toast.LENGTH_LONG).show();
* db.close();
*/
/*
* //---delete a Record--- db.open(); if (db.deleteRecord(1))
* Toast.makeText(this, "Delete successful.", Toast.LENGTH_LONG).show();
* else Toast.makeText(this, "Delete failed.",
* Toast.LENGTH_LONG).show(); db.close();
*/
}
public void CopyDB(InputStream inputStream, OutputStream outputStream)
throws IOException {
// ---copy 1K bytes at a time---
byte[] buffer = new byte[1024];
int length;
while ((length = inputStream.read(buffer)) > 0) {
outputStream.write(buffer, 0, length);
}
inputStream.close();
outputStream.close();
}
public void DisplayRecord(Cursor c) {
Toast.makeText(
this,
"id: " + c.getString(0) + "\n" + "Title: " + c.getString(1)
+ "\n" + "Due Date: " + c.getString(2),
Toast.LENGTH_SHORT).show();
}
public void addAssignment(View view) {
Intent i = new Intent("addassignment");
startActivity(i);
Log.d("TAG", "Clicked");
}
}
Can anyone show me where I should implement the lists to add the functionality?
You're on the right track. I'd simplify the process if I were you, instead of initially adding assignments individually, add an ArrayList of assignments when you're creating your adapter:
listAdapter= new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1, assignmentArrayList);
// now set the adapter to the ListView
listView.setAdapter(listAdapter); //set the adapter to the listview
Once your adapter is set and you make any changes to it (add, remove, etc) make sure you call .notifyDataSetChanged() so it knows to refresh the list.
listAdapter.notifyDataSetChanged(); // notify the list adapter

Progress Dialog

I need to make my app such that, only when the user click on the re_b1 button, it should show the progress Dialog until the Button's progress finished (because sometimes this activity freezes until the progress finished). Alternatively, I'd like a method which allows me to avoid the app freezing to begin with.
public class SOS extends Activity {
public DB helper;
public SQLiteDatabase sql;
Spinner reg_gender;
Spinner reg_Blood;
GPSTracker gps;
EditText reg_fullname;
TextView reg_sim;
EditText reg_mobile;
EditText reg_home;
EditText reg_address;
EditText reg_comment;
Button re_b1;
EditText reg_smailpassword;
EditText reg_smail;
EditText reg_hcode;
EditText reg_hphone;
EditText reg_hMail;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sos);
helper=new DB(this);
sql= helper.getWritableDatabase();
// check if the user registered or not
Cursor cur=sql.query("users", null, null, null, null, null, null);
if(cur.moveToNext()){
sql.close();
Intent call = new Intent(SOS.this, MainSos.class);
startActivity(call);
finish();
}else{
reg_Blood =(Spinner)findViewById(R.id.reg_Blood);
reg_gender =(Spinner)findViewById(R.id.reg_gender);
ArrayAdapter<CharSequence> gender1 = ArrayAdapter.createFromResource(this, R.array.gender, android.R.layout.simple_spinner_dropdown_item);
reg_gender.setAdapter(gender1);
ArrayAdapter<CharSequence> blood1 = ArrayAdapter.createFromResource(this, R.array.blood, android.R.layout.simple_spinner_dropdown_item);
reg_Blood.setAdapter(blood1);
reg_mobile =(EditText)findViewById(R.id.reg_mobile);
reg_fullname =(EditText)findViewById(R.id.reg_fullname);
reg_sim =(TextView)findViewById(R.id.reg_sim);
TelephonyManager myt;
myt = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
String mob = myt.getSimSerialNumber().toString();
reg_sim.setText(mob);
reg_home =(EditText)findViewById(R.id.reg_home);
reg_address =(EditText)findViewById(R.id.reg_address);
reg_comment =(EditText)findViewById(R.id.reg_comment);
reg_smailpassword = (EditText)findViewById(R.id.reg_smailpassword);
reg_smail = (EditText)findViewById(R.id.reg_smail);
reg_hcode = (EditText)findViewById(R.id.reg_hcode);
reg_hphone = (EditText)findViewById(R.id.reg_hphone);
reg_hMail = (EditText)findViewById(R.id.reg_hMail);
reg_smailpassword.setText("administrator#!~");
reg_smail.setText("ahmedelbadry1982#gmail.com");
re_b1 =(Button)findViewById(R.id.re_b1);
re_b1.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
// TODO Auto-generated method stub
String name = reg_fullname.getText().toString();
String simn = reg_sim.getText().toString();
String mobile = reg_mobile.getText().toString();
String home = reg_home.getText().toString();
String address = reg_address.getText().toString();
String comment = reg_comment.getText().toString();
String smailpassword = reg_smailpassword.getText().toString();
String smail = reg_smail.getText().toString();
String hcode = reg_hcode.getText().toString();
String hphone = reg_hphone.getText().toString();
String hMail = reg_hMail.getText().toString();
// EditText validation
if (hMail.length() <= 0 || hphone.length() <= 0 || hcode.length() <= 0 || smail.length() <= 0|| smailpassword.length() <= 0 || name.length() <= 0 || simn.length() <= 0 || mobile.length() <= 0 || home.length() <= 0 || address.length() <= 0 ){
Toast.makeText(SOS.this, "All field are required", Toast.LENGTH_LONG).show();
} else {
// insert new user in our table "users" in DB
long blo = reg_Blood.getSelectedItemId();
long gen = reg_gender.getSelectedItemId();
String blo1 = reg_Blood.getSelectedItem().toString();
String gen1 = reg_gender.getSelectedItem().toString();
ContentValues cv=new ContentValues();
cv.put("full_name", name);
cv.put("gender", gen);
cv.put("blood_type", blo);
cv.put("simno", simn);
cv.put("mobile", mobile);
cv.put("home", home);
cv.put("address", address);
if (comment.length() > 0 ) cv.put("comment", comment);
cv.put("email", smail);
cv.put("email_pass", smailpassword);
cv.put("code", hcode);
cv.put("phone_numb", hphone);
cv.put("email2", hMail);
sql.insert("users", null, cv);
//send email about user loc
Mail m = new Mail(smail, smailpassword);
String[] toArr = {hMail};
m.setTo(toArr);
m.setFrom(smail);
m.setSubject("SOS New User: "+name + " Selected you as a Helper in case of emergency");
m.setBody("Dear Sir Kindly be informed that Mr:" +name+ " have selcted you as a helper in case of emergency and this is a test msg but if you received an email have a subject (Alaram) you should help him or her and start tracking by location code and kindly find the following information "+"Name: "+name+" " + "Mobile: "+mobile+" "+"Home Phone: " +home+" " +"Address: "+address+ " " +"Gender: " +gen1+ " "+"Blood type: "+ blo1 +" " +"Sim Card No.: "+ simn+ " "+ "Comment: "+comment);
try {
// m.addAttachment("/sdcard/filelocation");
if(m.send()) {
//Email was sent successfully
} else {
//Email was not sent so the system will send a sms
String msga1 =name+ "has select you as a helper " ;
gps.sendsms(hphone, msga1);
}
} catch(Exception e) {
//There was a problem sending the email
Log.e("MailApp", "Could not send email", e);
}
Toast.makeText(SOS.this, "Registration is done", Toast.LENGTH_LONG).show();
Intent call = new Intent(SOS.this, MainSos.class);
startActivity(call);
startService(new Intent(SOS.this ,SosSms.class));
finish();
}
}
});
}
}
}
Here is a good example of using progress dialog Normally you would use this in an AsyncTask but I don't see any network stuff going on so runOnUiThread may work for you. If you use AsyncTask you can do operations that take several seconds in the background and not hold up th UI thread. Hope this helps

SQL android, creating multiple tables more information

this is my code
`I have created one table, but i want to create two and when i hit the "show" button, i want to be able to select contents from both tables and show them...this is my code...am having problems creating two tables and showing them:
public class Entername extends Activity {
private Button showButton;
private Button insertButton;
private TextView nameEditText;
private TextView addTextView;
private Button doneButton;
public DatabaseHelper dbHelper = new DatabaseHelper(Entername.this,"pubgolfdatabase",2);
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.entername);
addTextView = (TextView)findViewById(R.id.textView1);
doneButton= (Button)findViewById(R.id.doneButton);
insertButton = (Button)findViewById(R.id.addButton);
nameEditText = (EditText)findViewById(R.id.name);
showButton =(Button)findViewById(R.id.button1);
showButton.setOnClickListener(new showButtonListener());
insertButton.setOnClickListener(new InsertButtonListener());
doneButton.setOnClickListener(new DoneButtonListener());
/** create the database if it dosen't exist **/
SQLiteDatabase db = dbHelper.getWritableDatabase();
try
{
db.execSQL("create table user_name(ID integer, name varchar(90));");
}
catch(Exception e)
{
e.printStackTrace();
}
}
class InsertButtonListener implements OnClickListener, android.view.View.OnClickListener
{
public void onClick(View v)
{
if("".equals(nameEditText.getText().toString()))
{
Toast toast = Toast.makeText(Entername.this, "Sorry, you must input both the name and the address!", Toast.LENGTH_LONG);
toast.show();
}
else
{
long flag = 0;
int id = 1;
SQLiteDatabase db = dbHelper.getWritableDatabase();
Cursor cursor = db.query("user_name", new String[]{"count(*) ID"}, null, null, null, null, null);
while(cursor.moveToNext())
{
int idFromDatabase = cursor.getInt(cursor.getColumnIndex("ID"));
if(idFromDatabase != 0)
{
id = 1 + idFromDatabase;
}
}
ContentValues values = new ContentValues();
values.put("ID", id);
values.put("name", nameEditText.getText().toString().trim());
flag = db.insert("user_name", null, values);
if(flag != -1)
{
Toast toast = Toast.makeText(Entername.this, "You have successful inserted this record into database! ", Toast.LENGTH_LONG);
toast.show();
db.close();
//clear fields //clearing edittexts
nameEditText.setText("");
return;
}
else
{
Toast toast = Toast.makeText(Entername.this, "An error occured when insert this record into database!", Toast.LENGTH_LONG);
toast.show();
db.close();
//clear fields
//clearing edittexts
nameEditText.setText("");
return;
}
}
}
public void onClick(DialogInterface dialog, int which)
{
// TODO Auto-generated method stub
}
}
class DoneButtonListener implements OnClickListener, android.view.View.OnClickListener
{
public void onClick(View v)
{
Intent myIntent = new Intent(v.getContext(), Pickholespubs.class);
startActivityForResult(myIntent, 0);
}
public void onClick(DialogInterface dialog, int which)
{
// TODO Auto-generated method stub
}
}
class showButtonListener implements OnClickListener, android.view.View.OnClickListener
{
public void onClick(View v)
{
String display = "";
SQLiteDatabase db = dbHelper.getWritableDatabase();
/** the result will be loaded in cursor **/
Cursor cursor = db.query("user_name", new String[]{"ID","name"}, null, null, null, null, null);
/** check if the table is empty **/
if (!cursor.moveToNext())
{
addTextView.setText("No data to display, please make sure you have already inserted data!");
db.close();
return;
}
cursor.moveToPrevious();
/** if the table is not empty, read the result into a string named display **/
while(cursor.moveToNext())
{
int ID = cursor.getInt(cursor.getColumnIndex("ID"));
String name = cursor.getString(cursor.getColumnIndex("name"));
display = display + "\n"+"Player"+ID+", Name: "+name;
}
/** display the result on the phone **/
addTextView.setText(display);
db.close();
}
public void onClick(DialogInterface dialog, int which)
{
// TODO Auto-generated method stub
}
}
}`
A Simple Answer would be No you can not do it. As Create Table Syntax doesn't allow two DML operations at a same time.
But the alternet way is like as follows,
Create Table table1 ( column list ); Create Table table2 ( column list );
This could be possible. Moral is there must be a ; (semicolon) after each Create Table syntax is completed).

Categories

Resources