alguem tem algum exemplo de update bem simples ai?
eu fiz para inserir na minha tabela mas não mudo nada la na tabela, eu uso o firebird 1.5
elenão deu certo, sei que é basico mas não entendo por que não deu certo, falto alguma coisa ?
alguem tem algum exemplo de update bem simples ai?
eu fiz para inserir na minha tabela mas não mudo nada la na tabela, eu uso o firebird 1.5
elenão deu certo, sei que é basico mas não entendo por que não deu certo, falto alguma coisa ?
[quote=jonata.zurchimitten]alguem tem algum exemplo de update bem simples ai?
eu fiz para inserir na minha tabela mas não mudo nada la na tabela, eu uso o firebird 1.5
update testejonata2
set codigo = '0001',
nome = 'NOME DE TESTE',
endereco = 'RUA DAS FLORES 12',
cidade = 'BLUMENAU',
estado = 'SC',
cpf = '00011122233'
elenão deu certo, sei que é basico mas não entendo por que não deu certo, falto alguma coisa ?
[/quote]
ocorreu erro ao fazer o update? se sim, qual?
código, normalmente, é a chave primária e não pode ser alterado.
então ficaria assim:
update testejonata2
set nome = 'NOME DE TESTE',
endereco = 'RUA DAS FLORES 12',
cidade = 'BLUMENAU',
estado = 'SC',
cpf = '00011122233'
where codigo = '0001'
se você não informar qual registro deseja alterar (“where codigo = ‘0001’”), todos os registros da tabela serão atualizados.
abraço.
agora deu o erro:
Arithmetic overflow or division by zero has occurred.
arithmetic exception, numeric overflow, or string truncation.
[quote=wbdsjunior][quote=jonata.zurchimitten]alguem tem algum exemplo de update bem simples ai?
eu fiz para inserir na minha tabela mas não mudo nada la na tabela, eu uso o firebird 1.5
update testejonata2
set codigo = '0001',
nome = 'NOME DE TESTE',
endereco = 'RUA DAS FLORES 12',
cidade = 'BLUMENAU',
estado = 'SC',
cpf = '00011122233'
elenão deu certo, sei que é basico mas não entendo por que não deu certo, falto alguma coisa ?
[/quote]
ocorreu erro ao fazer o update? se sim, qual?
código, normalmente, é a chave primária e não pode ser alterado.
então ficaria assim:
update testejonata2
set nome = 'NOME DE TESTE',
endereco = 'RUA DAS FLORES 12',
cidade = 'BLUMENAU',
estado = 'SC',
cpf = '00011122233'
where codigo = '0001'
se você não informar qual registro deseja alterar (“where codigo = ‘0001’”), todos os registros da tabela serão atualizados.
abraço.[/quote]
agora eu botei o jonatatabela2.codigo = ‘0001’ e mesmo assim não apreceu la na tabela eu deu um comit e ele ele deu transação feita ou algo assim mas não foi eu conferi na tabela, o que está faltando ?
update testejonata2
set codigo = '0001',
nome = 'NOME DE TESTE',
endereco = 'RUA DAS FLORES 12',
cidade = 'BLUMENAU',
estado = 'SC',
cpf = '00011122233'
[quote=jonata.zurchimitten]agora deu o erro:
Arithmetic overflow or division by zero has occurred.
arithmetic exception, numeric overflow, or string truncation.[/quote]
coloca aí o script de criação da sua tabela para agente dar uma olhada.
[quote=wbdsjunior][quote=jonata.zurchimitten]agora deu o erro:
Arithmetic overflow or division by zero has occurred.
arithmetic exception, numeric overflow, or string truncation.[/quote]
coloca aí o script de criação da sua tabela para agente dar uma olhada.[/quote]
desculpa, como acho isso ?
/*!!! Error occured !!!
This operation is not defined for system tables.
unsuccessful metadata update.
STORE RDB$INDICES failed.
attempt to store duplicate value (visible to active transactions) in unique index “RDB$INDEX_5”.
/
/!!! Error occured !!!
Invalid token.
Dynamic SQL Error.
SQL error code = -104.
Token unknown - line 1, char 8.
to.
/
/!!! Error occured !!!
Invalid token.
Dynamic SQL Error.
SQL error code = -104.
Token unknown - line 1, char 8.
to.
/
/!!! Error occured !!!
Invalid token.
Dynamic SQL Error.
SQL error code = -104.
Token unknown - line 1, char 8.
to.
/
/!!! Error occured !!!
Invalid token.
Dynamic SQL Error.
SQL error code = -104.
Token unknown - line 1, char 8.
to.
/
/!!! Error occured !!!
Invalid token.
Dynamic SQL Error.
SQL error code = -104.
Token unknown - line 2, char 1.
values.
/
/!!! Error occured !!!
Invalid token.
Dynamic SQL Error.
SQL error code = -104.
Token unknown - line 2, char 5.
(.
/
/!!! Error occured !!!
Arithmetic overflow or division by zero has occurred.
arithmetic exception, numeric overflow, or string truncation.
/
/!!! Error occured !!!
Arithmetic overflow or division by zero has occurred.
arithmetic exception, numeric overflow, or string truncation.
/
/!!! Error occured !!!
Arithmetic overflow or division by zero has occurred.
arithmetic exception, numeric overflow, or string truncation.
/
/!!! Error occured !!!
Arithmetic overflow or division by zero has occurred.
arithmetic exception, numeric overflow, or string truncation.
/
/!!! Error occured !!!
Arithmetic overflow or division by zero has occurred.
arithmetic exception, numeric overflow, or string truncation.
/
/!!! Error occured !!!
Arithmetic overflow or division by zero has occurred.
arithmetic exception, numeric overflow, or string truncation.
/
/!!! Error occured !!!
Arithmetic overflow or division by zero has occurred.
arithmetic exception, numeric overflow, or string truncation.
/
/!!! Error occured !!!
Arithmetic overflow or division by zero has occurred.
arithmetic exception, numeric overflow, or string truncation.
/
/!!! Error occured !!!
Arithmetic overflow or division by zero has occurred.
arithmetic exception, numeric overflow, or string truncation.
/
/!!! Error occured !!!
Arithmetic overflow or division by zero has occurred.
arithmetic exception, numeric overflow, or string truncation.
/
/!!! Error occured !!!
Arithmetic overflow or division by zero has occurred.
arithmetic exception, numeric overflow, or string truncation.
/
/!!! Error occured !!!
Arithmetic overflow or division by zero has occurred.
arithmetic exception, numeric overflow, or string truncation.
/
/!!! Error occured !!!
Arithmetic overflow or division by zero has occurred.
arithmetic exception, numeric overflow, or string truncation.
/
/!!! Error occured !!!
Arithmetic overflow or division by zero has occurred.
arithmetic exception, numeric overflow, or string truncation.
/
/!!! Error occured !!!
Arithmetic overflow or division by zero has occurred.
arithmetic exception, numeric overflow, or string truncation.
/
/!!! Error occured !!!
Arithmetic overflow or division by zero has occurred.
arithmetic exception, numeric overflow, or string truncation.
/
/!!! Error occured !!!
Arithmetic overflow or division by zero has occurred.
arithmetic exception, numeric overflow, or string truncation.
/
/!!! Error occured !!!
Arithmetic overflow or division by zero has occurred.
arithmetic exception, numeric overflow, or string truncation.
/
/!!! Error occured !!!
Arithmetic overflow or division by zero has occurred.
arithmetic exception, numeric overflow, or string truncation.
/
/!!! Error occured !!!
Arithmetic overflow or division by zero has occurred.
arithmetic exception, numeric overflow, or string truncation.
/
/!!! Error occured !!!
Arithmetic overflow or division by zero has occurred.
arithmetic exception, numeric overflow, or string truncation.
/
/!!! Error occured !!!
Arithmetic overflow or division by zero has occurred.
arithmetic exception, numeric overflow, or string truncation.
/
/!!! Error occured !!!
Arithmetic overflow or division by zero has occurred.
arithmetic exception, numeric overflow, or string truncation.
/
/!!! Error occured !!!
Arithmetic overflow or division by zero has occurred.
arithmetic exception, numeric overflow, or string truncation.
/
/!!! Error occured !!!
Arithmetic overflow or division by zero has occurred.
arithmetic exception, numeric overflow, or string truncation.
/
/!!! Error occured !!!
Arithmetic overflow or division by zero has occurred.
arithmetic exception, numeric overflow, or string truncation.
/
/!!! Error occured !!!
Arithmetic overflow or division by zero has occurred.
arithmetic exception, numeric overflow, or string truncation.
/
/!!! Error occured !!!
Arithmetic overflow or division by zero has occurred.
arithmetic exception, numeric overflow, or string truncation.
*/
???
não está dando certo
e onde é que eu acho o script de erro ?
[quote=jonata.zurchimitten][quote=wbdsjunior][quote=jonata.zurchimitten]agora deu o erro:
Arithmetic overflow or division by zero has occurred.
arithmetic exception, numeric overflow, or string truncation.[/quote]
coloca aí o script de criação da sua tabela para agente dar uma olhada.[/quote]
desculpa, como acho isso ?[/quote]
são os comandos utilizados para criar a tabela.
algo como:
quero saber qual o tipo de dado de cada campo da tabela, se você criou constraints de primary key, foreign kei, etc.
as mensagens aparentemente indicam que está tentando inserir um tipo de dado diferente do dado do campo da tabela ou maior que o tamanho permitido.
abraço.
create table testejonata2
(
codigo char(4) not null primary key,
nome varchar(20) not null,
endereco varchar(20),
cidade varchar(15),
estado char(2),
cpf char(11)
)
update testejonata2
set nome = 'NOME DE TESTE',
endereco = 'RUA DAS FLORES 12',
cidade = 'BLUMENAU',
estado = 'SC',
cpf = '00011122233'
where codigo = '0001'
acima foi quando criei a tabela, depois inseri os dados nela e agora queria mudar(update), omde está o erro ?
siga os seguintes passos
--deleta a tabela
DROP TABLE testejonata2
--cria a tabela
CREATE TABLE testejonata2
(
codigo CHAR(4) NOT NULL PRIMARY KEY,
nome VARCHAR(20) NOT NULL,
endereco VARCHAR(20),
cidade VARCHAR(15),
estado CHAR(2),
cpf CHAR(11)
)
--insere o registro
INSERT INTO TESTEJONATA2 VALUES('0001', 'TESTE', 'RUA TESTE, 10', 'CAMPO GRANDE', 'MS', '00000000');
--atualiza o registro
UPDATE testejonata2
SET nome = 'NOME DE TESTE',
endereco = 'RUA DAS FLORES 12',
cidade = 'BLUMENAU',
estado = 'SC',
cpf = '00011122233'
WHERE codigo = '0001'
--lista o registro
SELECT * FROM TESTEJONATA2 t
WHERE t.CODIGO = '0001'