我正在使用Oracle SQL数据库中的NodeJS进行以下查询
export async function getGuard(req: Request, res: Response): Promise<any> {
const conn = await connect();
let { document} = req.params;
const result = await conn.execute(
`
select ideide
from basdat.siide, basdat.siideead
where idecod='${document}'
and idecod=ideeadcod
and ideeadact='S'
`
);
console.log(result.rows[0][0].length);
if (result.rows[0][0].length > 0) {
return res.json(result.rows[0][0]);
} else {
res.status(404).json({ text: "Registro no existe" });
}
}
我正在尝试验证,如果我发送给您的记录不存在,它可以在Angular Registration表格中生成一个动作
this.documentreg = this.forma.value.document
console.log(this.documentreg);
this._usuarioService.getdocument(this.forma.value.document)
.subscribe( resp => {
this.documentser = resp;
if (this.documentreg == this.documentser) {
console.log('Are not equal');
} else {
console.log('Are equal ');
}
}, err => {
console.log(err);
}
);
当注册存在时,IF被执行,但是当我传递不存在的文档时,它没有给我任何回报,我什至没有执行IF
PD:我仅用于检查文档是否存在的Oracle数据库,我没有在其中存储任何内容