create table query using sqlite

조회 수: 2 (최근 30일)
nikhil nambiar
nikhil nambiar 2017년 8월 12일
댓글: nikhil nambiar 2017년 8월 13일
Hi,
I need to know how can I create table in sqlite database using exec. I have created connection object
con=sqlite('dbname.db','create');
I tried exec to create table for above database
curs=exec(conn,create table Atable('sno int primary key,xyz long, adb long'));
matlab throws an error with:
curs=exec(conn,create table R&DE('sno int primary key,latitude long, longitude long'));
Error: Unexpected MATLAB expression.
Next I tried doing
curs=exec(con,['create table R&DE(sno int primary key,latitude long, longitude long)']);
Error using sqlite/exec
Too many output arguments.
A solution or advice to this will be valuable
Thank you!!

채택된 답변

Walter Roberson
Walter Roberson 2017년 8월 12일
Notice that cur is not returned in the example of creating a table:
exec(con, 'create table R&DE(sno int primary key,latitude long, longitude long)' );
Note: you might need to quote that table name:
exec(con, 'create table "R&DE"(sno int primary key,latitude long, longitude long)' );
  댓글 수: 2
nikhil nambiar
nikhil nambiar 2017년 8월 13일
It doesnt work Matlab throws an error: to many output argument
nikhil nambiar
nikhil nambiar 2017년 8월 13일
My apologies !! It does work. Thank you

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by