SunQuest
           Oracle Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesOracle Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old May 21st, 2004, 12:23 PM
jtp51 jtp51 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: Omaha, Nebraska
Posts: 63 jtp51 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 27 m 5 sec
Reputation Power: 5
Question Oracle Temp Table and PHP

SUMMARY

The following is what I have done with no success. I will have to strip down the SQL statements or try to get the results without a temp table. Plus, I have tried this with and without calling the SQL statement in the variable $sql3.

Has anyone tried to create a temp table in Oracle using PHP, then displaying the results and deleting the temp table?


Code:
$sql0 = "CREATE GLOBAL TEMPORARY TABLE TMP".$subnum."
(GROUPID VARCHAR2(8))";


$sql1 = "INSERT INTO TMP".$subnum." (SELECT DISTINCT GROUPID FROM TAB_COLOR_PRODUCT
WHERE PRODUCTID IN (SELECT GROUPID
FROM TAB_COLOR_SUBGROUP
WHERE SUBNUM = '".$subnum."'
AND UNITNUM = '".$unitnum."' )
AND GROUPID LIKE '06%')";


$sql2 = "SELECT a.SEGMENT, b.DESCRIPTION, a.MENU_POS, a.SEG_ORDER FROM TAB_COLOR_SEGMENT A,
TAB_COLOR_DEFS B WHERE b.ID = a.SEGMENT AND a.SEGMENT IN ((SELECT GROUPID
FROM TMP".$subnum.")
MINUS
SELECT DISTINCT b.PAGEMBR FROM TAB_COLOR_LPN a, TAB_COLOR_PAGEMBR b WHERE
                       a.SEGMENT IN (SELECT GROUPID FROM TMP".$subnum.")
                       AND b.LPN = a.LPN
                       AND b.PGMBR_ORDER = '001'
                       AND b.PAGEMBR IN (SELECT GROUPID FROM TMP".$subnum.")
 )
ORDER BY MENU_POS, SEG_ORDER";


$sql3 = "DROP TABLE TMP".$subnum;


$cursor = OCILogon($user, $pass, $tns);
  if ( ! $cursor ) {
    echo "Unable to connect: " . var_dump( OCIError() );
    die();
  }

// CREATE TEMP TABLE
$createTMP = OCIParse($cursor, $sql0);
OCIExecute($createTMP, OCI_DEFAULT);

// INSERT DATA INTO TEMP TABLE
$insrtTMP = OCIParse($cursor, $sql1);
OCIExecute($insrtTMP, OCI_DEFAULT);

// SELECT DATA
$slctDATA = OCIParse($cursor, $sql2);
OCIExecute($slctDATA, OCI_DEFAULT);
//-------------------------------------------------------
while (OCIFetchInto($slctDATA, $row, OCI_ASSOC | OCI_RETURN_NULLS)){
	print $row['SEGMENT'].' '.$row['DESCRIPTION'].' '.$row['MENU_POS'].' '.$row['SEG_ORDER'].'<br>';
}
//-------------------------------------------------------
// DELETE TEMP TABLE
$deleteTMP = OCIParse($cursor, $sql3);
OCIExecute($deleteTMP, OCI_DEFAULT);

OCILogoff($cursor);
__________________
--Todd

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesOracle Development > Oracle Temp Table and PHP


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway