-
Similar Content
-
By NaPraia
Beleza?
seguinte, tivemos problema com o servidor que pegou fogo, foi recuperado, porém não estou conseguindo compilar uma view
se eu executo:
select * from v_view , funciona
se eu executo a query da view, também funciona
select 1 campo from dual Porém, quando tento recompilar a view, dá erro
create or replace view v_view as select 1 campo from dual No caso, minha query tem várias tabelas, estava dando esse erro numa tabela, consegui solucionar com o comando
grant select on owner1.tabela to owner2 with grant option; Mas para a segunda tabela, esse comando não funcionou.
executei o revoke e depois novamente o grant e também não foi
REVOKE all ON owner1.tabela FROM owner2; Isso é em ambiente de homologação e percebi que o campo grantable está YES e em produção está setado para NO com o comando abaixo e em produção está funcionando, consigo compilar a view
select * from user_tab_privs where table_name = 'tabela'
Alguém tem idéia do que pode ser? o que é que está pegando?
Obrigado
-
By Kellison Ruan
Acho que não fui tão claro no título, portanto irei esmiuçar melhor aqui...
É o seguinte, quero saber se há algum jeito de pegar as linhas de uma coluna q está em VARCHAR com informações do tipo "4 PONTOS DE ILUMINAÇÃO", dessa informação pretendo retirar somente o número que em questão é o "4" e colocá-lo em outra coluna INTEGER. Há essa possibilidade? Detalhe, as vezes as informações não está seguindo um padrão de vim somente como "4 PONTOS DE ILUMINAÇÃO" às vezes vêm dados com mais informações númericas que precisa distinguir, por exemplo, a mim só interessa pegar números que vem antecedendo as palavras "PONTOS", "PTOS", "PTS", têm algum jeito de distinguir isso?
-
By Quencyjones79
Olá a todos, sou novo na área de multimídia. Estou a seguir a um momento um ebook sobre a criação de uma base de dados e também a criação de tabelas. Mas quando vinculei as tabelas do banco de dados, no phpmyadmin me deu alguns erros. Fiz a correspondência da chave primária (artist_id da tabela Artist) com a artist_id da tabela Prints (chave estrangeira) e assim por diante. O problema é que ele não mostra minhas relações das tabelas e me dá uma mensagem de erro. Então, alguns de vocês poderiam me ajudar, por favor, a consertar esta situação. Eu serei grato. Cumprimentos.
Ps .: Abaixo envio o arquivo Sql.
Atentamente,
José Moreira
-- phpMyAdmin SQL Dump -- version 5.0.2 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: Jan 07, 2021 at 08:49 PM -- Server version: 10.4.14-MariaDB -- PHP Version: 7.2.33 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; START TRANSACTION; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- Database: `ecommerce` -- -- -------------------------------------------------------- -- -- Table structure for table `artists` -- CREATE TABLE `artists` ( `artist_id` int(10) UNSIGNED NOT NULL, `first_name` varchar(20) DEFAULT NULL, `middle_name` varchar(20) DEFAULT NULL, `last_name` varchar(40) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4; -- -------------------------------------------------------- -- -- Table structure for table `customers` -- CREATE TABLE `customers` ( `customer_id` int(10) UNSIGNED NOT NULL, `email` varchar(60) NOT NULL, `pass` char(40) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4; -- -------------------------------------------------------- -- -- Table structure for table `orders` -- CREATE TABLE `orders` ( `order_id` int(10) UNSIGNED NOT NULL, `customer_id` int(10) UNSIGNED NOT NULL, `total` decimal(10,2) UNSIGNED NOT NULL, `order_date` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -------------------------------------------------------- -- -- Table structure for table `order_contents` -- CREATE TABLE `order_contents` ( `oc_id` int(10) UNSIGNED NOT NULL, `order_id` int(10) UNSIGNED NOT NULL, `print_id` int(10) UNSIGNED NOT NULL, `quantity` tinyint(3) UNSIGNED NOT NULL DEFAULT 1, `price` decimal(6,2) UNSIGNED NOT NULL, `ship_date` datetime DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -------------------------------------------------------- -- -- Table structure for table `prints` -- CREATE TABLE `prints` ( `print_id` int(10) UNSIGNED NOT NULL, `artist_id` int(10) UNSIGNED NOT NULL, `print_name` varchar(60) NOT NULL, `price` decimal(6,2) UNSIGNED NOT NULL, `size` varchar(60) DEFAULT NULL, `description` varchar(255) DEFAULT NULL, `image_name` varchar(60) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4; -- -- Indexes for dumped tables -- -- -- Indexes for table `artists` -- ALTER TABLE `artists` ADD PRIMARY KEY (`artist_id`), ADD UNIQUE KEY `full_name` (`last_name`,`first_name`,`middle_name`); -- -- Indexes for table `customers` -- ALTER TABLE `customers` ADD PRIMARY KEY (`customer_id`), ADD UNIQUE KEY `email` (`email`), ADD KEY `login` (`email`,`pass`); -- -- Indexes for table `orders` -- ALTER TABLE `orders` ADD PRIMARY KEY (`order_id`), ADD KEY `customer_id` (`customer_id`), ADD KEY `order_date` (`order_date`); -- -- Indexes for table `order_contents` -- ALTER TABLE `order_contents` ADD PRIMARY KEY (`oc_id`), ADD KEY `order_id` (`order_id`), ADD KEY `print_id` (`print_id`), ADD KEY `ship_date` (`ship_date`); -- -- Indexes for table `prints` -- ALTER TABLE `prints` ADD PRIMARY KEY (`print_id`), ADD KEY `artist_id` (`artist_id`), ADD KEY `print_name` (`print_name`), ADD KEY `price` (`price`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `artists` -- ALTER TABLE `artists` MODIFY `artist_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `customers` -- ALTER TABLE `customers` MODIFY `customer_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `orders` -- ALTER TABLE `orders` MODIFY `order_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `order_contents` -- ALTER TABLE `order_contents` MODIFY `oc_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `prints` -- ALTER TABLE `prints` MODIFY `print_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; COMMIT; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
-
By Júnior César
Estou batendo a cabeça na parte de vericaçao de dados existente no banco, nesse caso eu estou tentando verificar se o cpf digitado apos validado existe no banco, mas não esta funcionando, não se e o erro esta no javascprit ou na pagina php, sera que alguem consegue me ajudar? Obrigado
segue as paginas:
cadastro.html
<html lang="pt-br"> <head> <meta charset="UTF-8"> <link rel="stylesheet" href="Classes/css/estilo.css"> <script src="js/jquery-1.7.2.min.js"></script> <script src="js/jquery.validate.min.js"></script> <script src="js/validacao.js"></script> <script> </script> <title><?php echo $acaoPagina ?></title> </head> <body> <header> <nav> <ul> <li><a href="index.php">Inicio</a></li> <li><a href="especialidades.php">Especialidades</a></li> <li><a href="cadastrarMedico.php"> Cadastrar Médico</a></li> <li><a href="cadastrarEspecialidades.php">Cadastrar Especialidades</a></li> </ul> </nav> </header> <main> <section> <div class="div-25 cadastro"> <h1> <?php echo $acaoPagina ?> </h1> <span id="resultado"></span> <form id="formulario" name="frmcpf" action="dadosMedico.php" method="POST" onsubmit="camposMedico();"> <input type="hidden" name="id" value="<?php echo $Medico->getId_medico() ?>"> <input type="text" name="nome" placeholder="Nome" value="<?php echo $Medico->getNome() ?>"> <input type="text" name="cpf" placeholder="CPF" value="<?php echo $Medico->getCpf() ?>"> <input type="date" name="nascimento" value="<?php echo $Medico->getNascimento() ?>"> <input type="email" name="email" placeholder="E-Mail" value="<?php echo $Medico->getEmail() ?>"> <input type="text" name="telefone" placeholder="Telefone" value="<?php echo $Medico->getTelefone() ?>"> <input type="text" name="watshapp" placeholder="Watshapp" value="<?php echo $Medico->getWhatswapp() ?>"> <input type="text" name="crm" placeholder="CRM" value="<?php echo $Medico->getCrn() ?>"> <input type="text" name="salario" placeholder="Salário" value="<?php echo $Medico->getMedia_salarial() ?>"> <select name="especialidade_medico"> <?php if($Medico->getEspecialidade_nome()&& $Medico->getId_especialidade()): echo"<option value='{$Medico->getId_especialidade()}'>{$Medico->getEspecialidade_nome()}</option>"; else: echo"<option>Especialidade</option>"; endif; $selectDados->dadosEpcialidade($Esp); ?> </select> <input type="submit" value="<?php echo $submit ?>" onclick="camposMedico();"> </form> </div> </section> </main> <footer> </footer> </body> </html> ------------------------------------------------------------------------------------------------------------------
validacao.js
function init() { $("#formulario").validate({ rules: { nome: { required: true }, cpf: { required: true, verificaCPF: true }, nascimento: { required: true, verificaIdade: true } }, messages: { nome: { required: "Campo Nome Obrigatório " }, cpf: { required: "Campo CPF Obrigatório" }, nascimento: { required: "Campo Nascimento Obrigatório" } } }); } jQuery.validator.addMethod("verificaCPF", function (value, element) { value = value.replace('.', ''); value = value.replace('.', ''); cpf = value.replace('-', ''); while (cpf.length < 11) cpf = "0" + cpf; var expReg = /^0+$|^1+$|^2+$|^3+$|^4+$|^5+$|^6+$|^7+$|^8+$|^9+$/; var a = []; var b = new Number; var c = 11; for (i = 0; i < 11; i++) { a = cpf.charAt(i); if (i < 9) b += (a * --c); } if ((x = b % 11) < 2) { a[9] = 0 } else { a[9] = 11 - x } b = 0; c = 11; for (y = 0; y < 10; y++) b += (a[y] * c--); if ((x = b % 11) < 2) { a[10] = 0; } else { a[10] = 11 - x; } if ((cpf.charAt(9) != a[9]) || (cpf.charAt(10) != a[10]) || cpf.match(expReg)) return false; var verifica=false; jQuery.ajax({ url: 'teste.php?cpf='+cpf, async: false, success: function(data) { if(data == 0) verifica = true; }}); if(!verifica) return false; return true; }, "Informe um CPF válido."); jQuery.validator.addMethod("verificaIdade", function (value, element) { var data = new Date(); value = value.split("-"); nascimento = value; var anos = data.getFullYear() - nascimento[0]; if (nascimento[1] > data.getMonth()) { anos -= 1; } else if (nascimento[1] == data.getMonth()) { if (nascimento[2] > data.getDate()) { anos -= 1; } } if (anos <= 22) { return false; } return true; }, "A idade não pode ser menor que 22 anos "); $(document).ready(init);
----------------------------------------------
teste.php
<!DOCTYPE html> <html lang="pt-br"> <head> <meta charset="UTF-8"> <title></title> </head> <body> <?php #Verifica se tem um email para pesquisa //$emailPostado = "jrcjuniorcesar@gmil.com"; if(isset($_GET['cpf'])){ #Recebe o Email Postado $emailPostado = $_GET['cpf']; #Conecta banco de dados $con = mysqli_connect("localhost", "root", "", "crud"); $sql = mysqli_query($con, "SELECT * FROM medicos where cpf ='{$emailPostado}'") or print mysqli_errno($con); #Se o retorno for maior do que zero, diz que já existe um. $valor; if(($sql) AND ($sql->num_rows != 0)){ while($linha= mysqli_fetch_assoc($sql)){ $valor = $sql->num_rows. "<br>"; } }else{ $valor = 0; } echo $valor; } ?> </body> </html> --------------------------
Banco de dados
create database crud; use crud; create table especialidades( cod int auto_increment, especialidade varchar (45), primary key(cod) ); create table medicos( id int auto_increment, nome varchar(45), nascimento date, cpf varchar(11) unique key, crm varchar(10), email varchar(35) unique key, telefone varchar(12), whatsapp varchar(12), salario double, especialidade_medico int, primary key(id), foreign key(especialidade_medico) references especialidades(cod)
-