I am trying to create a temporary table that is loaded each timea user logs into the application.
I am building the table dynamically and my error checks are coming out showing no errors.
However, when I try to build the SQL statement to load the contents of the temp table, I do not see
any rows.
The li_errorSQLSELECT shows a 1 whereas the li_retrieve is showing 0 (which I think means 0 rows)
I tested the SQL statement and I do get rows returned.
Is what I am trying to do even possible?
Thank you for the help
ls_createtable = 'create table #useraccount (username varchar(20),
+ 'staffid varchar(10), ' &
+ 'accesslevel varchar(3), '&
+ 'stafftype varchar(3), '&
+ 'department varchar(25)) '
// Insert data to the temp table
ls_inserttable = 'insert into #useraccount ' &
+ 'SELECT DISTINCT dbo.useraccount.username, ' &
+ 'dbo.staffmember.staffstateid, ' &
+ 'dbo.staffmember.staffstateid, ' &
+ 'accesslevel = null, ' &
+ 'stafftype = null, ' &
+ 'dbo.staffmember.departmentname' &
+ 'FROM dbo.person, dbo.staffmember, dbo.useraccount ' &
+ 'WHERE ( dbo.person.personid = dbo.staffmember.personid ) and ' &
+ '( dbo.useraccount.personid = dbo.person.personid ) and ' &
+ '( dbo.useraccount.disable = 0 ) and ' &
+ '( dbo.staffmember.teacher = 1 ) and ' &
+ '( dbo.staffmember.enddate is null ) and ' &
+ 'dbo.staffmember.staffstateid is not null and ' &
+ 'dbo.staffmember.counselor <> 1 '
execute immediate :ls_createtable using sqlca;
if sqlca.sqlcode = 0 then
execute immediate :ls_inserttable using sqlca;
if sqlca.sqlcode = 0 then
messagebox("Insert error", sqlca.sqlerrtext)
end if
else
messagebox("Create error", sqlca.sqlerrtext)
end if
ls_gettemptabledata = 'SELECT username, password,staffid,accesslevel,stafftype,department FROM #useraccount '
// retrieve the teacher log id lookup table
li_errorSQLSELECT = dw_2.SetSqlSelect(ls_gettemptabledata)
li_retrieve = dw_2.retrieve()
I am building the table dynamically and my error checks are coming out showing no errors.
However, when I try to build the SQL statement to load the contents of the temp table, I do not see
any rows.
The li_errorSQLSELECT shows a 1 whereas the li_retrieve is showing 0 (which I think means 0 rows)
I tested the SQL statement and I do get rows returned.
Is what I am trying to do even possible?
Thank you for the help
ls_createtable = 'create table #useraccount (username varchar(20),
+ 'password varchar(10), ' &+ 'staffid varchar(10), ' &
+ 'accesslevel varchar(3), '&
+ 'stafftype varchar(3), '&
+ 'department varchar(25)) '
// Insert data to the temp table
ls_inserttable = 'insert into #useraccount ' &
+ 'SELECT DISTINCT dbo.useraccount.username, ' &
+ 'dbo.staffmember.staffstateid, ' &
+ 'dbo.staffmember.staffstateid, ' &
+ 'accesslevel = null, ' &
+ 'stafftype = null, ' &
+ 'dbo.staffmember.departmentname' &
+ 'FROM dbo.person, dbo.staffmember, dbo.useraccount ' &
+ 'WHERE ( dbo.person.personid = dbo.staffmember.personid ) and ' &
+ '( dbo.useraccount.personid = dbo.person.personid ) and ' &
+ '( dbo.useraccount.disable = 0 ) and ' &
+ '( dbo.staffmember.teacher = 1 ) and ' &
+ '( dbo.staffmember.enddate is null ) and ' &
+ 'dbo.staffmember.staffstateid is not null and ' &
+ 'dbo.staffmember.counselor <> 1 '
execute immediate :ls_createtable using sqlca;
if sqlca.sqlcode = 0 then
execute immediate :ls_inserttable using sqlca;
if sqlca.sqlcode = 0 then
messagebox("Insert error", sqlca.sqlerrtext)
end if
else
messagebox("Create error", sqlca.sqlerrtext)
end if
ls_gettemptabledata = 'SELECT username, password,staffid,accesslevel,stafftype,department FROM #useraccount '
// retrieve the teacher log id lookup table
li_errorSQLSELECT = dw_2.SetSqlSelect(ls_gettemptabledata)
[/in
dw_2.settransobject(SQLCA)li_retrieve = dw_2.retrieve()