Re: [SQL] LONG - Question on dealing w/ numerics

2003-01-29 Thread Tom Lane
"David Durst" <[EMAIL PROTECTED]> writes: > But I still think your point about the function selecting more than > one line is valid. > The problem is, the journal_line_id is not created until the insert > occurs and there is no other unique ident than the journal_line_id. Well, my standard answer

Re: [SQL] LONG - Question on dealing w/ numerics

2003-01-29 Thread David Durst
> "David Durst" <[EMAIL PROTECTED]> writes: >> insert into journal_lines >> (entry_id,account_id,line_type,line_amount) >> values (eid,aid,ltype,amount); >> select into line * from journal_lines where entry_id = eid AND >> account_id = aid AND ltype = ltype; > > I bet that last should be line_t

Re: [SQL] LONG - Question on dealing w/ numerics

2003-01-28 Thread Tom Lane
"David Durst" <[EMAIL PROTECTED]> writes: > insert into journal_lines (entry_id,account_id,line_type,line_amount) > values (eid,aid,ltype,amount); > select into line * from journal_lines where entry_id = eid AND > account_id = aid AND ltype = ltype; I bet that last should be line_type = ltype?

Re: [SQL] LONG - Question on dealing w/ numerics

2003-01-28 Thread Josh Berkus
David, > Cash - Debit 100 > A/R - Credit 100 > Cash - Credit 100 > A/R - Debit 100 > (Which should have a net affect of 0 on both accounts) > > But here is the resulting balance on accounts, > > Cash Debit Balance 200 > A/R Credit Balance 200 Here may your problem, and it's in the schema

Re: [SQL] LONG - Question on dealing w/ numerics

2003-01-28 Thread Josh Berkus
David, > I have a function that is to create a Accounting JOURNAL entry. > The strange thing is the function works for simple entries such as: > Here is the function and I can't seem to figure out what is LOGICALLY > wrong and would produce these results. I'm not sure the problem is with the fun

[SQL] LONG - Question on dealing w/ numerics

2003-01-28 Thread David Durst
I have a function that is to create a Accounting JOURNAL entry. The strange thing is the function works for simple entries such as: Cash - Debit 100 A/R - Credit 100 But when I try to trick it or break it for testing purposes (IT DOES BREAK WHEN IT SHOULDN'T) on a entry like this: Cash - Debit