Another problem, sql table creating, no respond
What im trying to do is create table mysql table. My code looks like this:
import java.sql.*;
public class HelloWorldApp {
public static Connection con = null;
public static Statement stmt;
public static void createConnection() {
try {
String serverName = "127.0.0.1";
String mydatabase = "java";
String url = "jdbc:mysql://" + serverName + "/" + mydatabase;
Class.forName("com.mysql.jdbc.Driver").newInstance();
con = DriverManager.getConnection(url, "root", "");
stmt = con.createStatement();
} catch (Exception e) {
e.printStackTrace();
public static void createTable(String tableName) {
try {
Statement stmt = con.createStatement();
String sql = "CREATE TABLE tableName(col_string VARCHAR(254))";
stmt.executeUpdate(sql);
System.out.println("Table built: "+tableName);
} catch (SQLException e) {
e.printStackTrace();
public static void main(String args[]) {
System.out.println("Hello World!");
createConnection();
createTable("test");
}And the problem is, that after it prints "Hello world!" nothing hapands, its even not exits if i remove "pause" from run.bat. Anyway im stuck, please help.
Edited by: Godsent on Jan 1, 2009 2:00 PM
Edited by: Godsent on Jan 1, 2009 2:03 PM
A few notes on your code:
* Don't import everything from a given package, only what you need.
* Your tableName variable is not being used. You are using tableName literally in your variable named sql.
* This variable is not being used as you think
public static Statement stmt;You are creating a local variable with the same name in the the createTable method.
* You should always close your connections and statements. Read the API docs for each of these classes.
* Don't make everything static. Use instance variables and create an instance of your class with the new operator.
Are you getting any sort of error message printed to the shell? You could try adding more System.out.println() calls to see what's going on.
Similar Messages
-
Cast DBMS_SQL.NUMBER_TABLE to another pl/sql table-of-number type?
Using dynamic SQL, I am bulk-collecting two numeric fields into two tables of number. This works fine, the tables are DBMS_SQL.NUMBER_TABLE.
I am trying to feed an API that takes two table of these numbers, but its parameter types are different. Both are identical definitions to DBMS_SQL.NUMBER_TABLE, i.e., TABLE OF NUMBER INDEX BY BINARY_INTEGER.
I don't want to duplicate or copy 2500-7500 records to do this, but I can't find a way to use the api's table-of-number with DBMS_SQL.DEFINE_ARRAY. Nor can I use DBMS_SQL.NUMBER_TABLE with this API. I've tried a few CAST phrases, but it won't compile.
Can someone give me a suggestion here? I'd hate to set up a loop to copy the data from one table to another.
Thanks,
Andrew WolfeDikshit,
This is a volunteer forum. Getting impatient after 15 minutes is not especially nice behavior on your part.
Likely you pass the parameter the same way as you initialize a table inside the procedure, so (7141,7256,8913) etc.
In the worst scenario you would need to set up an anonymous block with a collection of type dbms_sql.number_table and initialize that collection.
But of course you can always verify this in the PL/SQL documentation.
Sybrand Bakker
Senior Oracle DBA -
Hi Friends,
I am using Oracle 8.1.6 Server, & facing problems while retrieving data from a PL/SQL Table:
CREATE or REPLACE PROCEDURE test_proc IS
TYPE tP2 is TABLE of varchar2(10); --declared a collection
dt2 tP2 := tP2('a','b','c');
i NUMBER(8);
begin
SELECT COUNT(*) INTO i FROM TABLE(CAST(dt2 as tP2));
DBMS_OUTPUT.PUT_LINE('**'||i);
end;
While executing the above procedure, I encountered foll. error:
ERROR at line 1:
ORA-00600: internal error code, arguments: [15419], [severe error during PL/SQL execution], [], [],
ORA-06544: PL/SQL: internal error, arguments: [pfrrun.c:pfrbnd1()], [], [], [], [], [], [], []
ORA-06553: PLS-801: internal error [0]
Can anyone please help me, where the problem is??
Is it Possible to retrieve data from PL/SQL TABLE using SELECT statement? & How ?
Thanks in advance.
Best Regards,
Jay Raval.Thanks Roger for the Update.
It means that have to first CREATE TYPE .. TABLE in database then only I can fire a Select statement on that TYPE.
Actually I wanted to fire a Select statement on the TABLE TYPE, defined & declared in PLSQL stored procedure using DECLARE TYPE .. TABLE & not using CREATE TYPE .. TABLE.
I was eager to know this, because my organization is reluctant in using CREATE TYPE .. TABLE defined in the database, so I was looking out for another alternative to access PL/SQL TABLE using Select statement without defining it database. It would have been good if I could access a PLSQL TABLE using Select statement Declared locally in the stored procedure.
Can I summarize that to access a PL/SQL TABLE using SELECT statement, I have to first CREATE TYPE .. TABLE?
If someone have any other idea on this, please do let me know.
Thanks a lot for all help.
Best Regards,
Jay Raval.
You have to define a database type...
create type tP2 is table of varchar2(10)
CREATE OR REPLACE PROCEDURE TEST_PROC
IS
dt2 tP2 := tP2('a','b','c');
i NUMBER(8);
begin
SELECT COUNT(*) INTO i FROM TABLE(CAST (dt2 AS tP2));
DBMS_OUTPUT.PUT_LINE('**'||i);
end;
This will work.
Roger -
Dynamic number of PL/SQL tables help!!!
Hi,
I have a PL/SQL code in which I am using PL/SQL table of tables.
The number of such tables created in the code can be dynamic.
At the end of the procedure I want to insert the records from those PL/SQL tables into a database table.
Something like this.
insert into DBL.RA_CONTROL_REPORT (time_slot1,time_slot2,time_slot3,time_slot4,time_slot5,time_slot6,time_slot7,
time_slot8,time_slot9,time_slot10,time_slot11,time_slot12,time_slot13,time_slot14,time_slot15,time_slot16,
time_slot17,time_slot18,time_slot19,time_slot20,time_slot21,time_slot22,time_slot23,time_slot24,time_slot25,
time_slot26,time_slot27,time_slot28,time_slot29,time_slot30,time_slot31,time_slot32,time_slot33,time_slot34,
time_slot35,time_slot36,time_slot37,time_slot38,time_slot39,time_slot40,time_slot41,time_slot42,time_slot43
,time_slot44,time_slot45,time_slot46,time_slot47,time_slot48)
values ( Outer_table(1)(i),Outer_table(2)(i),Outer_table(3)(i),Outer_table(4)(i),Outer_table(5)(i)
,Outer_table(6)(i),Outer_table(7)(i),Outer_table(8)(i),Outer_table(9)(i),Outer_table(10)(i),Outer_table(11)(i)
,Outer_table(12)(i),Outer_table(13)(i),Outer_table(14)(i),Outer_table(15)(i),Outer_table(16)(i),Outer_table(17)(i)
,Outer_table(18)(i),Outer_table(19)(i),Outer_table(20)(i),Outer_table(21)(i),Outer_table(22)(i),Outer_table(23)(i)
,Outer_table(24)(i),Outer_table(25)(i),Outer_table(26)(i),Outer_table(27)(i),Outer_table(28)(i),Outer_table(29)(i)
,Outer_table(30)(i),Outer_table(31)(i),Outer_table(32)(i),Outer_table(33)(i),Outer_table(34)(i),Outer_table(35)(i)
,Outer_table(36)(i),Outer_table(37)(i),Outer_table(38)(i),Outer_table(39)(i),Outer_table(40)(i),Outer_table(41)(i)
,Outer_table(42)(i),Outer_table(43)(i),Outer_table(44)(i),Outer_table(45)(i),Outer_table(46)(i),Outer_table(47)(i)
,Outer_table(48)(i));
Here, DBL.RA_CONTROL_REPORT is my database table.
And each Outer_table()() is my PL/SQL table.
I need to make this query dynamic by inserting only from those many number of PL/SQL tales which are created.
Assume that I know the number of PL/SQL tables created.
But when I try to do so, and apply execute immediate to that query. It gives me an error as unimplemented feature.
Sample code where I have tried doing so is as follows:
Query3:='insert into DBL.RA_CONTROL_REPORT (';
for i in 1..max_cnt loop
for idx in 1..Interval_Count loop
col_name :=col_name||'time_slot'||idx||',';
table_name :=table_name||'Outer_table('||idx||')('||i||'),';
end loop;
col_name:=rtrim(col_name,',');
table_name:=rtrim(table_name,',');
Query3:=Query3||col_name||') values('||table_name||')';
dbms_output.put_line(query3);
execute immediate query3;
commit;
end loop;
Where max_cnt -> No of PL/SQL tables created.
Please help.Now using the above approach to determine the bucket for a row, this result can be (outer) joined to the 48 buckets for the day and one can determine whether there are values for that bucket or not.
For example:
SQL> with MV as(
2 select
3 trunc(sysdate)+(dbms_random.value(1,24)/24) as TIME,
4 trunc(dbms_random.value(1,100)) as B
5 from dual
6 connect by level <= 1000
7 ),
8 DATA_BUCKETS as(
9 select
10 time,
11 --// determine the decimal hour
12 (to_number(to_char(time,'hh24'))*60)
13 +to_number(to_char(time,'mi')) as MINUTES,
14 --// use the decimal minute to determine
15 --// which half-hour bucket it goes into
16 trunc( ((to_number(to_char(time,'hh24'))*60)+
17 +to_number(to_char(time,'mi')))
18 /30
19 )+1 as BUCKET,
20 b
21 from mv
22 ),
23 ACTUAL_BUCKETS as(
24 select
25 level as BUCKET
26 from dual
27 connect by level <= 48
28 )
29 select
30 actual_buckets.bucket,
31 sum(b),
32 case --// is there data in the data bucket?
33 when sum(data_buckets.b) is null then 'No'
34 else
35 'Yes'
36 end as BUCKET_HAS_DATA
37 from actual_buckets,
38 data_buckets
39 where actual_buckets.bucket = data_buckets.bucket (+)
40 group by
41 actual_buckets.bucket
42 order by 1
43 /
BUCKET SUM(B) BUCKET_HAS_DATA
1 No
2 No
3 1321 Yes
4 1582 Yes
5 1409 Yes
6 786 Yes
7 1082 Yes
8 1323 Yes
9 998 Yes
10 1462 Yes
11 850 Yes
12 947 Yes
13 1033 Yes
14 1224 Yes
15 655 Yes
16 810 Yes
17 1319 Yes
18 702 Yes
19 994 Yes
20 671 Yes
21 1136 Yes
22 1199 Yes
23 1034 Yes
24 1184 Yes
25 1470 Yes
26 890 Yes
27 1549 Yes
28 740 Yes
29 1229 Yes
30 833 Yes
31 1159 Yes
32 1613 Yes
33 1234 Yes
34 770 Yes
35 1196 Yes
36 1324 Yes
37 1263 Yes
38 1155 Yes
39 785 Yes
40 1130 Yes
41 1286 Yes
42 1056 Yes
43 1462 Yes
44 1032 Yes
45 831 Yes
46 888 Yes
47 806 Yes
48 995 Yes
48 rows selected.
SQL>I leave the pivot of this into a single row with 48 columns for you to research and figure out. I'm also pretty sure that other forum members can provide a lot more elegant examples than what I've done here.
The point is that SQL is a very powerful and very capable data processing language. And if you want to build Oracle solutions that are robust and performant and scalable, then you need to Mamimise Maximise SQL and Minimise PL/SQL*.
In other words - do not use PL/SQL when SQL can do the job better and faster.
Edited by: Billy Verreynne on Sep 16, 2011 9:40 AM -
Creating a PL/SQL table based on XML file.
I have created two procedures to try and achieve the problem at hand.
It retrieves and displays the record from a DBMS_OUTPUT.PUT_LINE prospective as indicated in (1&2), but I am having difficulty loading these values into a PL/SQL table from the package labeled as (3).
All code compiles. (1&2) work together, (3) works by itself but will not populate the table, and I get no errors.
1.The first being the one that retrieves the XML file and parses it.
CREATE OR REPLACE procedure xml_main is
P XMLPARSER.Parser;
DOC CLOB;
v_xmldoc xmldom.DOMDocument;
v_out CLOB;
BEGIN
P := xmlparser.newParser;
xmlparser.setValidationMode(p, FALSE);
DOC := '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<com.welligent.Student.BasicStudent.Create>
<ControlAreaSync messageCategory="com.welligent.Student" messageObject="BasicStudent" messageAction="Create" messageRelease="1.0" messagePriority="1" messageType="Sync">
<Sender>
<MessageId>
<SenderAppId>com.openii.SyncRouter</SenderAppId>
<ProducerId>a72af712-90ea-43be-b958-077a87a29bfb</ProducerId>
<MessageSeq>53</MessageSeq>
</MessageId>
<Authentication>
<AuthUserId>Router</AuthUserId>
</Authentication>
</Sender>
<Datetime>
<Year>2001</Year>
<Month>3</Month>
<Day>23</Day>
<Hour>13</Hour>
<Minute>47</Minute>
<Second>30</Second>
<SubSecond>223</SubSecond>
<Timezone>6:00-GMT</Timezone>
</Datetime>
</ControlAreaSync>
<DataArea>
<NewData>
<BasicStudent mealCode="" usBorn="Yes" migrant="No" workAbility="No" ellStatus="">
<StudentNumber>052589F201</StudentNumber>
<ExternalIdNumber>1234567890</ExternalIdNumber>
<StateIdNumber>123456</StateIdNumber>
<Name>
<LastName>Lopez</LastName>
<FirstName>Maria</FirstName>
<MiddleName>S</MiddleName>
</Name>
<Gender>Female</Gender>
<BirthDate>
<Month>1</Month>
<Day>1</Day>
<Year>1995</Year>
</BirthDate>
<Race>Hispanic</Race>
<Ethnicity>Hispanic</Ethnicity>
<PrimaryLanguage>English</PrimaryLanguage>
<HouseholdLanguage>Spanish</HouseholdLanguage>
<Address>
<Street>123 Any Street</Street>
<ApartmentNumber>12-D</ApartmentNumber>
<City>Los Angeles</City>
<County>Los Angeles</County>
<State>CA</State>
<ZipCode>90071</ZipCode>
</Address>
</BasicStudent>
</NewData>
</DataArea>
</com.welligent.Student.BasicStudent.Create>';
--v_out := DOC;
SYS.XMLPARSER.PARSECLOB ( P, DOC );
v_xmldoc := SYS.XMLPARSER.getDocument(P);
--DBMS_LOB.createtemporary(v_out,FALSE,DBMS_LOB.SESSION);
--v_out := SYS.XMLPARSER.PARSECLOB ( P, DOC );
--SYS.XMLDOM.writetoCLOB(v_xmldoc, v_out);
--INSERT INTO TEST (TEST_COLUMN)
--VALUES(V_OUT);
--printElements(v_xmldoc);
printElementAttributes(v_xmldoc);
exception
when xmldom.INDEX_SIZE_ERR then
raise_application_error(-20120, 'Index Size error');
when xmldom.DOMSTRING_SIZE_ERR then
raise_application_error(-20120, 'String Size error');
when xmldom.HIERARCHY_REQUEST_ERR then
raise_application_error(-20120, 'Hierarchy request error');
when xmldom.WRONG_DOCUMENT_ERR then
raise_application_error(-20120, 'Wrong doc error');
when xmldom.INVALID_CHARACTER_ERR then
raise_application_error(-20120, 'Invalid Char error');
when xmldom.NO_DATA_ALLOWED_ERR then
raise_application_error(-20120, 'Nod data allowed error');
when xmldom.NO_MODIFICATION_ALLOWED_ERR then
raise_application_error(-20120, 'No mod allowed error');
when xmldom.NOT_FOUND_ERR then
raise_application_error(-20120, 'Not found error');
when xmldom.NOT_SUPPORTED_ERR then
raise_application_error(-20120, 'Not supported error');
when xmldom.INUSE_ATTRIBUTE_ERR then
raise_application_error(-20120, 'In use attr error');
END;
2. The second which displays the values from the .xml file I initialized above.
CREATE OR REPLACE procedure printElementAttributes(doc xmldom.DOMDocument) is
nl XMLDOM.DOMNODELIST;
len1 NUMBER;
len2 NUMBER;
n XMLDOM.DOMNODE;
e XMLDOM.DOMELEMENT;
nnm XMLDOM.DOMNAMEDNODEMAP;
attrname VARCHAR2(100);
attrval VARCHAR2(100);
text_value VARCHAR2(100):=NULL;
n_child XMLDOM.DOMNODE;
BEGIN
-- get all elements
nl := XMLDOM.getElementsByTagName(doc, '*');
len1 := XMLDOM.getLength(nl);
-- loop through elements
FOR j in 0..len1-1 LOOP
n := XMLDOM.item(nl, j);
e := XMLDOM.makeElement(n);
DBMS_OUTPUT.PUT_LINE(xmldom.getTagName(e) || ':');
-- get all attributes of element
nnm := xmldom.getAttributes(n);
n_child:=xmldom.getFirstChild(n);
text_value:=xmldom.getNodeValue(n_child);
dbms_output.put_line('val='||text_value);
IF (xmldom.isNull(nnm) = FALSE) THEN
len2 := xmldom.getLength(nnm);
dbms_output.put_line('length='||len2);
-- loop through attributes
FOR i IN 0..len2-1 LOOP
n := xmldom.item(nnm, i);
attrname := xmldom.getNodeName(n);
attrval := xmldom.getNodeValue(n);
dbms_output.put(' ' || attrname || ' = ' || attrval);
END LOOP;
dbms_output.put_line('');
END IF;
END LOOP;
END printElementAttributes;
3. The package trying to insert into a PL/SQL table.
CREATE OR REPLACE PACKAGE BODY XMLSTUD2 AS
PROCEDURE STUDLOAD
IS
v_parser xmlparser.Parser;
v_doc xmldom.DOMDocument;
v_nl xmldom.DOMNodeList;
v_n xmldom.DOMNode;
DOC CLOB;
v_out CLOB;
n2 XMLDOM.DOMNODELIST;
TYPE stuxml_type IS TABLE OF STUDENTS%ROWTYPE;
s_tab stuxml_type := stuxml_type();
--l_sturec students%rowtype;
BEGIN
-- Create a parser.
v_parser := xmlparser.newParser;
xmlparser.setValidationMode(v_parser, FALSE);
DOC := '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<com.welligent.Student.BasicStudent.Create>
<ControlAreaSync messageCategory="com.welligent.Student" messageObject="BasicStudent" messageAction="Create" messageRelease="1.0" messagePriority="1" messageType="Sync">
<Sender>
<MessageId>
<SenderAppId>com.openii.SyncRouter</SenderAppId>
<ProducerId>a72af712-90ea-43be-b958-077a87a29bfb</ProducerId>
<MessageSeq>53</MessageSeq>
</MessageId>
<Authentication>
<AuthUserId>Router</AuthUserId>
</Authentication>
</Sender>
<Datetime>
<Year>2001</Year>
<Month>3</Month>
<Day>23</Day>
<Hour>13</Hour>
<Minute>47</Minute>
<Second>30</Second>
<SubSecond>223</SubSecond>
<Timezone>6:00-GMT</Timezone>
</Datetime>
</ControlAreaSync>
<DataArea>
<NewData>
<BasicStudent mealCode="" usBorn="Yes" migrant="No" workAbility="No" ellStatus="">
<StudentNumber>052589F201</StudentNumber>
<ExternalIdNumber>1234567890</ExternalIdNumber>
<StateIdNumber>123456</StateIdNumber>
<Name>
<LastName>Lopez</LastName>
<FirstName>Maria</FirstName>
<MiddleName>S</MiddleName>
</Name>
<Gender>Female</Gender>
<BirthDate>
<Month>1</Month>
<Day>1</Day>
<Year>1995</Year>
</BirthDate>
<Race>Hispanic</Race>
<Ethnicity>Hispanic</Ethnicity>
<PrimaryLanguage>English</PrimaryLanguage>
<HouseholdLanguage>Spanish</HouseholdLanguage>
<Address>
<Street>123 Any Street</Street>
<ApartmentNumber>12-D</ApartmentNumber>
<City>Los Angeles</City>
<County>Los Angeles</County>
<State>CA</State>
<ZipCode>90071</ZipCode>
</Address>
</BasicStudent>
</NewData>
</DataArea>
</com.welligent.Student.BasicStudent.Create>';
-- Parse the document and create a new DOM document.
SYS.XMLPARSER.PARSECLOB ( v_parser, DOC );
v_doc := SYS.XMLPARSER.getDocument(v_parser);
-- Free resources associated with the Parser now it is no longer needed.
xmlparser.freeParser(v_parser);
-- Get a list of all the STUD nodes in the document using the XPATH syntax.
v_nl := xslprocessor.selectNodes(xmldom.makeNode(v_doc),'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Address');
dbms_output.put_line( 'New Stud processed on '||to_char(sysdate, 'YYYY-MON-DD'));
-- Loop through the list and create a new record in a tble collection
-- for each STUD record.
FOR stud IN 0 .. xmldom.getLength(v_nl) - 1 LOOP
v_n := xmldom.item(v_nl, stud);
s_tab.extend;
-- Use XPATH syntax to assign values to he elements of the collection.
--s_tab(s_tab.last).STUDENT_ID :=xslprocessor.valueOf(v_n,'StudentNumber');
--s_tab(s_tab.last).SSN :=xslprocessor.valueOf(v_n,'ExternalIdNumber');
--s_tab(s_tab.last).SHISID :=xslprocessor.valueOf(v_n,'StateIdNumber');
s_tab(s_tab.last).STUDENT_LAST_NAME :=xslprocessor.valueOf(v_n,'LastName');
--dbms_output.put_line( s_tab(s_tab.last).STUDENT_LAST_NAME);
s_tab(s_tab.last).STUDENT_FIRST_NAME :=xslprocessor.valueOf(v_n,'FirstName');
--s_tab(s_tab.last).STUDENT_MI :=xslprocessor.valueOf(v_n,'MiddleName');
--s_tab(s_tab.last).STUDENT_GENDER :=xslprocessor.valueOf(v_n,'Gender');
--s_tab(s_tab.last).SHISID :=xslprocessor.valueOf(v_n,'Month');
--s_tab(s_tab.last).SHISID :=xslprocessor.valueOf(v_n,'Day');
--s_tab(s_tab.last).SHISID :=xslprocessor.valueOf(v_n,'Year');
--s_tab(s_tab.last).STUDENT_RACE :=xslprocessor.valueOf(v_n,'Race');
--s_tab(s_tab.last).STUDENT_ETHNIC :=xslprocessor.valueOf(v_n,'Ethnicity');
--s_tab(s_tab.last).STUDENT_PRI_LANG :=xslprocessor.valueOf(v_n,'PrimaryLanguage');
--s_tab(s_tab.last).STUDENT_SEC_LANG :=xslprocessor.valueOf(v_n,'HouseholdLanguage');
--s_tab(s_tab.last).STUDENT_STREET :=xslprocessor.valueOf(v_n,'Street');
--s_tab(s_tab.last).STUDENT_APART_NO :=xslprocessor.valueOf(v_n,'ApartmentNumber');
--s_tab(s_tab.last).STUDENT_COUNTY :=xslprocessor.valueOf(v_n,'City');
--s_tab(s_tab.last).STUDENT_COUNTY :=xslprocessor.valueOf(v_n,'County');
--s_tab(s_tab.last).STUDENT_STATE :=xslprocessor.valueOf(v_n,'State');
--s_tab(s_tab.last).STUDENT_ZIP :=xslprocessor.valueOf(v_n,'ZipCode');
END LOOP;
FOR stud IN s_tab.first..s_tab.last LOOP
dbms_output.put_line( s_tab(s_tab.last).STUDENT_LAST_NAME);
INSERT INTO STUDENTS (
SHISID, SSN, DOE_SCHOOL_NUMBER,
PATIENT_TYPE, TEACHER, HOMEROOM,
STUDENT_LAST_NAME, STUDENT_FIRST_NAME, STUDENT_MI,
STUDENT_DOB, STUDENT_BIRTH_CERT, STUDENT_COMM,
STUDENT_MUSA, STUDENT_FAMSIZE, STUDENT_FAMINCOME,
STUDENT_UNINSURED, STUDENT_LUNCH, STUDENT_ZIP,
STUDENT_STATE, STUDENT_COUNTY, STUDENT_STREET,
STUDENT_APART_NO, STUDENT_PHONE, STUDENT_H2O_TYPE,
STUDENT_WASTE_TRT, STUDENT_HOME_SET, STUDENT_NONHOME_SET,
STUDENT_GENDER, STUDENT_RACE, STUDENT_ETHNIC,
STUDENT_PRI_LANG, STUDENT_SEC_LANG, STUDENT_ATRISK,
EMER_COND_MEMO, ASSIST_DEVICE_TYPE, SCHOOL_ENTER_AGE,
STUDENT_CURR_GRADE, S504_ELIG_DATE, S504_DEV_DATE,
S504_REV_DATE, STUDENT_504, STUDENT_IEP,
IEP_EXP_DATE, GRAD_CLASS, TYPE_DIPLOMA,
GRADE_RETAIN, LIT_PASS_TEST_MATH, LIT_PASS_DATE_MATH,
LIT_PASS_TEST_WRITE, LIT_PASS_DATE_WRITE, LIT_PASS_TEST_READ,
LIT_PASS_DATE_READ, SPEC_ED_ELIG, SPEC_ED_CODE,
TRANSPORT_CODE, TRANSPORT_NO, PRIME_HANDICAP,
PRIME_HANDICAP_PERCENT, PRIME_HANDI_MANAGER, FIRST_ADD_HANDI,
FIRST_ADD_HANDICAP_PERCENT, FIRST_ADD_HANDI_504, FIRST_ADD_HANDI_504_DATE,
SECOND_ADD_HANDI, SECOND_ADD_HANDICAP_PERCENT, MED_EXTERNAL_NAME,
INS_TYPE, INS_PRI, INS_NAME,
INS_MEDICAID_NO, ELIGDATE, INS_PRIV_INSURANCE,
INS_APPR_BILL, INS_APPR_DATE, INS_PARENT_APPR,
INS_POL_NAME, INS_POL_NO, INS_CARRIER_NO,
INS_CARRIER_NAME, INS_CARRIER_RELATE, INS_AFFECT_DATE,
INS_COPAY_OV, INS_COPAY_RX, INS_COPAY_AMBUL,
INS_COPAY_EMER, INS_COPAY_OUTPAT, STUDENT_INACTIVE,
PHYS_ID, ENCOUNTERNUM, USERID,
MODDATE, STUDENT_ID, S504_DISABILITY,
CHAPTER1, WELLNESS_ENROLL, SCHOOL_OF_RESIDENCE,
INITIAL_IEP_DATE, CALENDAR_TRACK, USA_BORN,
ALT_ID, FUTURE_SCHOOL, IEP_LAST_MEETING,
IEP_LAST_SETTING, IEP_LAST_REFER_EVAL, THIRD_ADD_HANDI,
LEP, GIFTED, IEP_EXIT_REASON,
CASE_MANAGER_ID, INTAKE_NOTES, CALLER_PHONE,
CALL_DATE, CALLER_RELATIONSHIP, CALLER_NAME,
BUSINESS_PHONE, FAX, EMAIL,
HIGHEST_EDUCATION, INTAKE_DATE, SERVICE_COORDINATOR,
DISCHARGE_DATE, DISCHARGE_REASON, DISCHARGE_NOTES,
INTAKE_BY, INTAKE_STATUS, IEP_LAST_SERVED_DATE,
IEP_APC_DATE, IEP_EXIT_DATE, ADDRESS2,
LEGAL_STATUS, RELIGION, EMPLOYMENT_STATUS,
TARG_POP_GROUP1, TARG_POP_GROUP2, MARITAL_STATUS,
THIRD_ADD_HANDI_PERCENT, LAST_INTERFACE_DATE, SERVICE_PLAN_TYPE,
CURRENT_JURISDICTION, FIPS, BIRTH_PLACE_JURISDICTION,
BIRTH_PLACE_HOSPITAL, BIRTH_PLACE_STATE, BIRTH_PLACE_COUNTRY,
OTHER_CLIENT_NAME, SIBLINGS_WITH_SERVICES, PERM_SHARE_INFORMATION,
PERM_VERIFY_INSURANCE, REFERRING_AGENCY, REFERRING_INDIVIDUAL,
AUTOMATIC_ELIGIBILITY, INTAKE_IEP_ID, FUTURE_SCHOOL2,
FUTURE_SCHOOL3, TRANSLATOR_NEEDED, TOTAL_CHILDREN_IN_HOME,
REFERRED_BY, FAMILY_ID, SCREENING_CONSENT_FLAG,
PICTURE_FILE, DUAL_ENROLLED, DOE_SCHOOL_NUMBER2)
VALUES (123456789012, null,null ,
null,null,null ,s_tab(stud).STUDENT_LAST_NAME
, s_tab(stud).STUDENT_LAST_NAME,null ,
null ,null ,null ,
null ,null , null,
null ,null , null,
null ,null , null,
null ,null , null,
null ,null , null,
null ,null , null,
null ,null , null,
null ,null , null,
null ,null , null,
null ,null , null,
null ,null , null,
null ,null , null,
null ,null , null,
null ,null , null,
null ,null , null,
null ,null , null,
null ,null , null,
null ,null , null,
null ,null , null,
null ,null , null,
null ,null , null,
null ,null , null,
null ,null , null,
null ,null , null,
null ,null , null,
null ,null , null,
null ,null , null,
null ,null , null,
null ,null , null,
null ,null , null,
null ,null , null,
null ,null , null,
null ,null , null,
null ,null , null,
null ,null , null,
null ,null , null,
null ,null , null,
null ,null , null,
null ,null , null,
null ,null , null,
null ,null , null,
null ,null , null,
null ,null , null,
null ,null , null,
null ,null , null,
null ,null , null,
null ,null , null,
null ,null , null,
null ,null , null,
null, null,null );
END LOOP;
COMMIT;
-- Free any resources associated with the document now it
-- is no longer needed.
xmldom.freeDocument(v_doc);
END STUDLOAD;
END XMLSTUD2;
/Hi
I have created a PLSQL package based Oracle Portal
form. This is created a s a databse provider. I have
following questions to check :
1. How to capture return values from the package and
display different messages on success or failure ?
- http://download.oracle.com/docs/cd/B14099_19/portal.1014/b14135/pdg_portletbuilder.htm#BABBAFGI
Step 16
2. How to return to blank form by intializing already
entered values after successfuly process of the form
data.
- http://download.oracle.com/docs/cd/B14099_19/portal.1014/b14135/pdg_portletbuilder.htm#BABGBCHH
thanks
Manjith -
Hello everyone,
I’ve been assigned one requirement wherein I would like to read around 50 CSV files from a specified folder.
In step 1 I would like to create schema for this files, meaning take the CSV file one by one and create SQL table for it, if it does not exist at destination.
In step 2 I would like to append the data of these 50 CSV files into respective table.
In step 3 I would like to purge data older than a given date.
Please note, the data in these CSV files would be very bulky, I would like to know the best way to insert bulky data into SQL table.
Also, in some of the CSV files, there will be 4 rows at the top of the file which have the header details/header rows.
According to my knowledge I would be asked to implement this on SSIS 2008 but I’m not 100% sure for it.
So, please feel free to provide multiple approaches if we can achieve these requirements elegantly in newer versions like SSIS 2012.
Any help would be much appreciated.
Thanks,
Ankit
Thanks, <b>Ankit Shah</b> <hr> Inkey Solutions, India. <hr> Microsoft Certified Business Management Solutions Professionals <hr> http://ankit.inkeysolutions.comHello Harry and Aamir,
Thank you for the responses.
@Aamir, thank you for sharing the link, yes I'm going to use Script task to read header columns of CSV files, preparing one SSIS variable which will be having SQL script to create the required table with if exists condition inside script task itself.
I will be having "Execute SQL task" following the script task. And this will create the actual table for a CSV.
Both these components will be inside a for each loop container and execute all 50 CSV files one by one.
Some points to be clarified,
1. In the bunch of these 50 CSV files there will be some exception for which we first need to purge the tables and then insert the data. Meaning for 2 files out of 50, we need to first clean the tables and then perform data insert, while for the rest 48
files, they should be appended on daily basis.
Can you please advise what is the best way to achieve this requirement? Where should we configure such exceptional cases for the package?
2. For some of the CSV files we would be having more than one file with the same name. Like out of 50 the 2nd file is divided into 10 different CSV files. so in total we're having 60 files wherein the 10 out of 60 have repeated file names. How can we manage
this criteria within the same loop, do we need to do one more for each looping inside the parent one, what is the best way to achieve this requirement?
3. There will be another package, which will be used to purge data for the SQL tables. Meaning unlike the above package, this package will not run on daily basis. At some point we would like these 50 tables to be purged with older than criteria, say remove
data older than 1st Jan 2015. what is the best way to achieve this requirement?
Please know, I'm very new in SSIS world and would like to develop these packages for client using best package development practices.
Any help would be greatly appreciated.
Thanks, <b>Ankit Shah</b> <hr> Inkey Solutions, India. <hr> Microsoft Certified Business Management Solutions Professionals <hr> http://ankit.inkeysolutions.com
1. In the bunch of these 50 CSV files there will be some exception for which we first need to purge the tables and then insert the data. Meaning for 2 files out of 50, we need to first clean the tables and then perform
data insert, while for the rest 48 files, they should be appended on daily basis.
Can you please advise what is the best way to achieve this requirement? Where should we configure such exceptional cases for the package?
How can you identify these files? Is it based on file name or are there some info in the file which indicates
that it required a purge? If yes you can pick this information during file name or file data parsing step and set a boolean variable. Then in control flow have a conditional precedence constraint which will check the boolean variable and if set it will execute
a execte sql task to do the purge (you can use TRUNCATE TABLE or DELETE FROM TableName statements)
2. For some of the CSV files we would be having more than one file with the same name. Like out of 50 the 2nd file is divided into 10 different CSV files. so in total we're having 60 files wherein the 10 out of 60 have
repeated file names. How can we manage this criteria within the same loop, do we need to do one more for each looping inside the parent one, what is the best way to achieve this requirement?
The best way to achieve this is to append a sequential value to filename (may be timestamp) and then process
them in sequence. This can be done prior to main loop so that you can use same loop to process these duplicate filenames also. The best thing would be to use file creation date attribute value so that it gets processed in the right sequence. You can use a
script task to get this for each file as below
http://microsoft-ssis.blogspot.com/2011/03/get-file-properties-with-ssis.html
3. There will be another package, which will be used to purge data for the SQL tables. Meaning unlike the above package, this package will not run on daily basis. At some point we would like these 50 tables to be purged
with older than criteria, say remove data older than 1st Jan 2015. what is the best way to achieve this requirement?
You can use a SQL script for this. Just call a sql procedure
with a single parameter called @Date and then write logic like below
CREATE PROC PurgeTableData
@CutOffDate datetime
AS
DELETE FROM Table1 WHERE DateField < @CutOffDate;
DELETE FROM Table2 WHERE DateField < @CutOffDate;
DELETE FROM Table3 WHERE DateField < @CutOffDate;
GO
@CutOffDate which denote date from which older data have to be purged
You can then schedule this SP in a sql agent job to get executed based on your required frequency
Please Mark This As Answer if it solved your issue
Please Vote This As Helpful if it helps to solve your issue
Visakh
My Wiki User Page
My MSDN Page
My Personal Blog
My Facebook Page -
Can anyone help me in a problem with PL/SQL Tables & the Java getArray()
The problem is the following:
I would tike to get a PL/SQL Table (a table of varchar2) into a Java String Array.
It works very well except that instead of getting the characters in the PL/SQL Table
I receive the character codes in each string.
In the following example i should get:
spring
summer
outumn
winter
Instead I get:
0x737072696E67
0x73756D6D6572
0x6F7574756D6E
0x77696E746572
Steps to try the sample
1)Creating the following type
create or replace TYPE CHAR_ARRAY IS TABLE OF VARCHAR(32767);
2)Creating the following stored procedure
create or replace PROCEDURE MQ_MSG_PROCESSOR
MessageText in VARCHAR2,
QueueName out VARCHAR2,
RplyMessage out CHAR_ARRAY,
HastoCommit out NUMBER
AS
RMessage CHAR_ARRAY;
BEGIN
QueueName:='DEV_OUT';
RMessage:=CHAR_ARRAY();
RMessage.Extend(4);
RMessage(1):='spring';
RMessage(2):='summer';
RMessage(3):='outumn';
RMessage(4):='winter';
HastoCommit:=1;
RplyMessage:=RMessage;
END;
3)Copiling and running the following java class
import java.sql.*;
import oracle.sql.*;
import oracle.jdbc.oracore.Util;
import oracle.jdbc.driver.*;
import java.util.Dictionary;
public class ArrayExample
public static void main (String args[]) throws Exception
MSG Msg=null;
oracle.sql.ARRAY RMsg=null;
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
Connection conn = DriverManager.getConnection ("jdbc:oracle:oci8:@test","test", "test");
conn.setAutoCommit (false);
try
String []array={};
ArrayDescriptor desc=ArrayDescriptor.createDescriptor("CHAR_ARRAY",conn);
ARRAY CHAR_ARRAY=new ARRAY(desc,conn,array);
OracleCallableStatement sproc = (OracleCallableStatement)conn.prepareCall("{call GSM.MQ_TST.MQ_MSG_PROCESSOR(?, ?, ?, ?)}");
sproc.setString(1, "hello"); //MessageText
sproc.registerOutParameter(2, OracleTypes.VARCHAR); //QueueName
sproc.registerOutParameter(3, OracleTypes.ARRAY,"CHAR_ARRAY"); //RplyMessage
sproc.registerOutParameter(4, OracleTypes.NUMBER); //HastoCommit
sproc.execute();
CHAR_ARRAY=(oracle.sql.ARRAY)sproc.getARRAY(3);
array = (String [])CHAR_ARRAY.getArray();
for(int i=0;i<array.length;i++)
System.out.println(array);
catch(SQLException e)
System.out.println("Error while trying to execute MQ_MSG_PROCESSOR");
System.out.println(e);
conn.close();Hi,
I tried the code with same procedure.
That works out fine for me..
and it prints out exactly the same words as you mentioned..:))
may be you must have changed something later on.. which started printing character codes..
but for me it works perfectly fine..
All The Best..
Regards
Gurudatt
The problem is the following:
I would tike to get a PL/SQL Table (a table of
varchar2) into a Java String Array.
It works very well except that instead of getting the
characters in the PL/SQL Table
I receive the character codes in each string.
In the following example i should get:
spring
summer
outumn
winter
Instead I get:
0x737072696E67
0x73756D6D6572
0x6F7574756D6E
0x77696E746572
Steps to try the sample
1)Creating the following type
create or replace TYPE CHAR_ARRAY IS TABLE OF
VARCHAR(32767);
2)Creating the following stored procedure
create or replace PROCEDURE MQ_MSG_PROCESSOR
���MessageText in VARCHAR2,
���QueueName out VARCHAR2,
���RplyMessage out CHAR_ARRAY,
���HastoCommit out NUMBER
AS
���RMessage CHAR_ARRAY;
BEGIN
���QueueName:='DEV_OUT';
���RMessage:=CHAR_ARRAY();
���RMessage.Extend(4);
���RMessage(1):='spring';
���RMessage(2):='summer';
���RMessage(3):='outumn';
���RMessage(4):='winter';
���HastoCommit:=1;
���RplyMessage:=RMessage;
END;
3)Copiling and running the following java class
import java.sql.*;
import oracle.sql.*;
import oracle.jdbc.oracore.Util;
import oracle.jdbc.driver.*;
import java.util.Dictionary;
public class ArrayExample
���public static void main (String
args[]) throws Exception
���{
������MSG Msg=null;
������oracle.sql.ARRAY
RMsg=null;
������DriverManager.regis
erDriver(new oracle.jdbc.driver.OracleDriver());
������Connection conn =
DriverManager.getConnection
("jdbc:oracle:oci8:@test","test", "test");
������conn.setAutoCommit
(false);
������try
������{
���������S
ring []array={};
���������A
rayDescriptor
desc=ArrayDescriptor.createDescriptor("CHAR_ARRAY",conn
���������A
RAY CHAR_ARRAY=new ARRAY(desc,conn,array);
���������O
acleCallableStatement sproc =
(OracleCallableStatement)conn.prepareCall("{call
GSM.MQ_TST.MQ_MSG_PROCESSOR(?, ?, ?, ?)}");
���������s
roc.setString(1, "hello"); //MessageText
���������s
roc.registerOutParameter(2,
OracleTypes.VARCHAR);���//QueueName
���������s
roc.registerOutParameter(3,
OracleTypes.ARRAY,"CHAR_ARRAY");���//Rpl
Message
���������s
roc.registerOutParameter(4,
OracleTypes.NUMBER);������
//HastoCommit
���������s
roc.execute();
���������C
AR_ARRAY=(oracle.sql.ARRAY)sproc.getARRAY(3);
���������a
ray = (String [])CHAR_ARRAY.getArray();
���������f
r(int i=0;i<array.length;i++)
���������{
System.out.println(array);
���������}
������}
������catch(SQLException
e)
������{
���������S
stem.out.println("Error while trying to execute
MQ_MSG_PROCESSOR");
���������S
stem.out.println(e);
������}
������conn.close();
���} -
PL/SQL to create a temp table that will be dropped after session ends
Is it possible in PL/SQL to create a temp table that will be dropped after the session ends? Please provide example if possible. I can create a global temp table in PL/SQL but I am not sure how (if possible) to have it 'drop' once the session ends.
DB: 10g
OS: Wiindoze 2003 Server
:-)As others have mentioned (but probably not clearly explained), Oracle treats temporary tables differently to SQL Server.
In SQL Server you create a temporary table and it gets dropped (automatically I assume, I dont do SQL Server) after the session finishes. This will obviously allow each session to "request" a temporary table to use, then use it, and not have to worry about cleaning up the database after the session has finished.
Oracle takes a different approach...
On the assumption that each session is likely to be creating a temporary table for the same purposes, with the same structure, Oracle let's you create a Global Temporary Table a.k.a. GTT (which you've already come across). You only have to create this table once and you leave it on the database. This then means that any code written to use that table doesn't have to be dynamic code and can be verified and checked at compile time, just like code written for any other table. The difference of a GTT from a regular table is that any data you put into that table can only be seen by that session and will not interfere with any data of other sessions and, when you either commit, or end the session (depending on the "on commit delete rows" or "on commit preserve rows" option used when creating the GTT), that data from your own session will automatically be removed and hence the table is cleaned up that way, whilst the actual table itself remains.
Some people from SQL Server backgrounds try and create and drop tables dynamically in their PL/SQL code, but this leads to problems...
SQL> ed
Wrote file afiedt.buf
1 begin
2 execute immediate 'create table my_temp (x number)';
3 insert into my_temp values (1);
4 execute immediate 'drop table my_temp';
5* end;
SQL> /
insert into my_temp values (1);
ERROR at line 3:
ORA-06550: line 3, column 15:
PL/SQL: ORA-00942: table or view does not exist
ORA-06550: line 3, column 3:
PL/SQL: SQL Statement ignoredi.e. the code will not compile for direct DML statements trying to use that table.
They then try and get around this issue by making their DML statements dynamic too...
SQL> ed
Wrote file afiedt.buf
1 create or replace procedure my_proc is
2 begin
3 execute immediate 'create table my_temp (x number)';
4 execute immediate 'insert into my_temp values (''A'')';
5 execute immediate 'drop table my_temp';
6* end;
SQL> /
Procedure created.... which looks great and it compiles ok... but... when they try and run it...
SQL> exec my_proc;
BEGIN my_proc; END;
ERROR at line 1:
ORA-01722: invalid number
ORA-06512: at "SCOTT.MY_PROC", line 4
ORA-06512: at line 1... oops the code has a bug in it. Our DML statement was invalid.
This is really something that would have been caught at compile time, if the statement had been a direct DML statement rather than dynamic. And thus we see the problem with people trying to write all their code as dynamic SQL... it's more likely to contain bugs that won't be detected at compile time and only come to light at run time... sometimes only under certain conditions and sometimes once it's got into a production environment. Bad Idea!!!! ;)
Far better to never create tables (or most other database objects) at run time. Just create them once as part of the database design/implementation and use them as required, allowing you to catch the most common coding errors up front before they get anywhere near a test environment or worse still, a production environment. -
Issues with new tables created in SQL Modeler
Hi,
whenever I create new tables in SQL Modeler, and then on the Oracle DB using the generatedDDL , strange things happen:
When synchronizing the model with the Database, some tables, even if already existing on the DB, appear as missing and the generated DDL still contains the "CREATE TABLE ..." statement
When synchronizing the Database with the model, the new tables created on the DB appear twice, once with the correct name and the 2nd time with the original name and the suffix "v1".
There seems to be no way to properly synchronize the model with the DB, apart from removing the tables from the model and re-import the definitions from the DB.
What am I doing wrong ? It seems really strange to me that no one has ever reported a bug like this!
Thank youHi,
whenever I create new tables in SQL Modeler, and then on the Oracle DB using the generatedDDL
There seems to be no way to properly synchronize the model with the DB, apart from removing the tables from the model and re-import the definitions from the DB
I'm able to reproduce your problem in case tables are imported into model using more than one connections. You need to use "Sync New Objects" in compare models dialog and then there will be no need to delete and import
again tables from database. Unfortunately "Sync New Objects" functionality doesn't work in case objects are imported using more then one connections. I logged a bug for that.
Philip -
How create a record type and a pl/sql table of that record type in database
Hi
I want to create a record type and then I want to create a PL/SQL table in the oracle 9i database.
I have done it in PL/SQL block.
But when I am trying to do it in database it is throwing me some error.
Could you please tell me how can I do that?
Regardsuser576726 wrote:
Hi
I want to create a record type and then I want to create a PL/SQL table in the oracle 9i database.
I have done it in PL/SQL block.
But when I am trying to do it in database it is throwing me some error.
Could you please tell me how can I do that?
RegardsRECORD type is supported only in PL/SQL for SQL you need to use OBJECT type. -
Auto create request by reading a row in MS SQL table?
Auto create request by reading a row in MS SQL table?
If all required data for a particular request type were included in a row of a MS SQL db table (staging table), could a request be created using a db adaptor? Or is web services the only option to auto create a request?By definition, a DB adapter is part of ServiceLink and ServiceLink handles task-level integration, ie, it can externalize a task that's in a request that already exists. Web Services is the only option to create a new request.
-
How to let sql server 2008 know the table created at front end in c#
How to let sql server 2008 know the table created at front end in c#
The best solution is to create table type and pass the DataTable as table-valued parameter. I have an article on my web site about this:
http://www.sommarskog.se/arrays-in-sql-2008.html
The full article is a bit of overkill for what you are doing right now, but just the few first pages should get you going.
Erland Sommarskog, SQL Server MVP, [email protected] -
How to create pdf to be prepopulated from SQL Table
I am having trouble generating a PDF that will add rows depending on the amount of records in my SQL Table. For example i am trying to generate a billing report on a monthly cycle. The data which i have in the table is for a certain client with a date range from 01/01/2010 - 01/31/2010. I need the table to gennerate rows for 15 different days and all i seem to get is the last record. Here is my Coldfusion Code
<cfquery name="qBilling" datasource="PrintBilling">
SELECT *
From BillingRecord
</cfquery>
<cfoutput>
<cfpdfform action="populate" source="billing.PDF">
<cfpdfsubform name="Table1">
<cfpdfsubform name="Row1">
<cfloop query="qBilling">
<cfpdfformparam name="Batch" value="#qBilling.batch#" index="1">
<cfpdfformparam name="Batch" value="#qBilling.batch#" index="2">
<cfpdfformparam name="Date" value="#DateFormat(qBilling.date,"mm/dd/yy")#">
<cfpdfformparam name="DateRange1" value="#DateFormat(Now(),"mm/dd/yy")#">
<cfpdfformparam name="DateRange2" value="#DateFormat(Now(),"mm/dd/yy")#">
<cfpdfformparam name="Documents" value="33333">
<cfpdfformparam name="PBcount" value="1252">
<cfpdfformparam name="PBpostage" value="999">
<cfpdfformparam name="Paper" value="5555">
<cfpdfformparam name="Price" value="1900">
<cfpdfformparam name="Rate" value="3.42">
<cfpdfformparam name="Type" value="SASAS-SS">
</cfloop>
</cfpdfsubform>
</cfpdfsubform>
</cfpdfform>
</cfoutput>
The PDF itself is saved as a Static Form only because thats what ive seen as the common problem.
Any help at all would be VERY much appreciated.I would make two summary tables that refers to the main table (the one you are currently sorting) :
1) the first summarizes by color
2) the second by model.
It would be quicker if you can poast a screenshot of the data table and charts you are making so that any examples are well suited to your specific case. -
Can I create ASP user validated website using existing MD5 passwords from SQL table?
I'm attempting to build a user authenticated site in Dreamweaver CS5 using an existing USERS table from another site. The password field in the existing SQL table appears to be MD5 encoded. How can I MD5 encode the form field (or the SQL query) so that it verifies MD5 to MD5?
Currently, it's comparing the form's plain text field to the MD5 encrypted password field in SQL.
I've built a simple login form using the following:
<form id="form1" name="form1" method="POST" action="<%=MM_LoginAction%>">
<input name="username" type="text" id="username" accesskey="u" tabindex="1" /><input name="password" type="password" id="password" accesskey="p" tabindex="2" /><input name="submit" type="submit" value="submit" />
</form>
With the stock Dreamweaver Log In User Server Behavior as follows:
<%
' *** Validate request to log in to this site.
MM_LoginAction = Request.ServerVariables("URL")
If Request.QueryString <> "" Then MM_LoginAction = MM_LoginAction + "?" + Server.HTMLEncode(Request.QueryString)
MM_valUsername = CStr(Request.Form("username"))
If MM_valUsername <> "" Then
Dim MM_fldUserAuthorization
Dim MM_redirectLoginSuccess
Dim MM_redirectLoginFailed
Dim MM_loginSQL
Dim MM_rsUser
Dim MM_rsUser_cmd
MM_fldUserAuthorization = ""
MM_redirectLoginSuccess = "results.asp"
MM_redirectLoginFailed = "error.html"
MM_loginSQL = "SELECT user_name, password"
If MM_fldUserAuthorization <> "" Then MM_loginSQL = MM_loginSQL & "," & MM_fldUserAuthorization
MM_loginSQL = MM_loginSQL & " FROM dbo.users WHERE user_name = ? AND password = ?"
Set MM_rsUser_cmd = Server.CreateObject ("ADODB.Command")
MM_rsUser_cmd.ActiveConnection = MM_ADSX_STRING
MM_rsUser_cmd.CommandText = MM_loginSQL
MM_rsUser_cmd.Parameters.Append MM_rsUser_cmd.CreateParameter("param1", 200, 1, 32, MM_valUsername) ' adVarChar
MM_rsUser_cmd.Parameters.Append MM_rsUser_cmd.CreateParameter("param2", 200, 1, 32, Request.Form("password")) ' adVarChar
MM_rsUser_cmd.Prepared = true
Set MM_rsUser = MM_rsUser_cmd.Execute
If Not MM_rsUser.EOF Or Not MM_rsUser.BOF Then
' username and password match - this is a valid user
Session("MM_Username") = MM_valUsername
If (MM_fldUserAuthorization <> "") Then
Session("MM_UserAuthorization") = CStr(MM_rsUser.Fields.Item(MM_fldUserAuthorization).Value)
Else
Session("MM_UserAuthorization") = ""
End If
if CStr(Request.QueryString("accessdenied")) <> "" And false Then
MM_redirectLoginSuccess = Request.QueryString("accessdenied")
End If
MM_rsUser.Close
Response.Redirect(MM_redirectLoginSuccess)
End If
MM_rsUser.Close
Response.Redirect(MM_redirectLoginFailed)
End If
%>
Please help!unfortunately classic asp does not have a built in function for md5. what we used for our legacy sites is a javascript that hashes a string to MD5. here's the code we've used in the past http://pajhome.org.uk/crypt/md5/md5.html
your asp should have something like this...
<script language="jscript" src="path_to_js_file/md5.js" runat="server"></script>
<%
'hash the password
Dim md5password ' md5password variable will hold the hashed text from form variable txtPassword
md5password = hex_md5(""&Request("txtPassword")&"")
' based on the code you posted...
MM_rsUser_cmd.Parameters.Append MM_rsUser_cmd.CreateParameter("param2", 200, 1, 32, md5password) ' adVarChar
%> -
Please find solution for this problem ...pl/sql table problem
Hi
I am using forms 6i. Now i am having a form to insert purpose. which contain 70 fields to enter. that is there are 10 screens contain 10 fields each. Each screen contains two buttons 'next' and 'previousscreen'. Now what my problem is after entering the 20 fields and i am entering 27th field in 3rd screen i noticed that i did a mistake in 2nd field value which is in 2nd screen. when i moved from third scrren to first screen by using pushbutton previous screen. all data in second and third screen has gone. For this i used a pl/sql table and put the code in 'nextscreen' button. the code is
declare
type emptabtype is table of :emp%rowtype
index by binary_integer;
emptab emptabtype;
begin
insert into emptab values(:emp.eno,:emp.ename.....so on);
commit;
end;
The above is the approach i used. but not successful. Is the approach followed by me is correct (I strongly believe that some mistake is there). If not, pls tell me what to do for my problem. What my ultimate requirement is i should not loss the data entered in the fields even when i modify any data on any screen.
I hope you people understand my problem
Thanks in Advance,
bigginner in forms
prasanth a.s.Hi there,
I have a form which has over 150 fields (from 4 tables). I have used a tab-canvas form to handle all the input - 2 screens for the fields from the first table and 1 screen each for the remaining 3 tables. I can navigate between the tabs without trouble. When everything is done, the contents of the screens are saved to the database via a menu item. Most of the fields are database items.
My point is that Oracle Form has no problems in handling
such processing and I am only using its normal default capabilities.
What type of canvas are you using? There should be no reason to use buttons to navigate betweeen screens if you are using a tab-canvas form. You should not have to use PL/SQL table to handle the data if the fields are normal database columns.
Regards,
John
Maybe you are looking for
-
When my project launches from the LMS, the lauch window is smaller that the actual project size and requires the user to resize the window to see the whole project. My LMS administrator tells me that the launch window size is not controlled by the LM
-
Error in using the FM 'L_TO_CREATE_MULTIPLE'
Hi Gurus, I have a custom report, let's call it YREV, in ABAP that uses the FM 'L_TO_CREATE_MULTIPLE' and gives an error as follows: "(STOP) Material is not the same for confirmation and delivery" Note: (STOP) is an icon. The scenario is that YREV is
-
Do I need to clean my computer like I did with my Dell?
Hi I have a MacBook Air I was wondering if I need to clean up records etc like I did on my old Dell computer. I know very little about computers. Thanks Dennis
-
Why can't I find a digital copy of a movie?
I supposedly used a digital copy code of a movie I purchased. Bluray/Digital Copy DVD I look for it in my iTunes library and it is not there, yet if I try to enter the code, it tells me I have already used that code. Where did my digital copy go?
-
Trying to make in game purchase. Keep's telling me purchase could not be made go to apple support