jteixeira Posted February 14, 2007 Share Posted February 14, 2007 Hi,I have 2 tables:Table 1 i have: PRUNIT, IVA,QUANT, TPDOCUM, NNUMDOC, NUMLINHA, ARTIGOTable 2 i have: TPDOC,NNUMDOC,DATA,SERIE,TERCEIRO,RGIVA,MOEDA,TOTDOCMBI want to insert in the table 2 TOTDOCMB=(PRUNIT + (PRUNIT * (IVA/100)))*QUANTI do this: Create PROCEDURE Preço @p int asset @p=(select (PRUNIT + (PRUNIT * (IVA/100)))*QUANT as PreçoFinal FROM DOCGCLIN WHERE TPDOCUM LIKE 'ENC' AND NNUMDOC=4 AND NUMLINHA=1 AND ARTIGO='AC011')INSERT INTO DOCGCCAB (TPDOC,NNUMDOC,DATA,SERIE,TERCEIRO,RGIVA,MOEDA,TOTDOCMB)VALUES('ENC',4,CURRENT_TIMESTAMP,1,528,'POR','EUR',@p)Return PreçoBut it doesn't work Link to comment Share on other sites More sharing options...
packrat Posted February 14, 2007 Share Posted February 14, 2007 I think that the division operation might be getting you into trouble, I don't know your data but I can see that @p is an INT which the /100 operation may be violating.Also why are we passing @p in as a parameter when we're not going to use the value passed?how is it not working? errors? no output? what's the db platform? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now